Files
effect/packages/cli/CHANGELOG.md
T
github-actions[bot]andgithub-actions[bot] 46efdc6f90 Version Packages (#3668)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-25 15:13:15 +12:00

143 KiB

@effect/cli

0.45.2

Patch Changes

0.45.1

Patch Changes

0.45.0

Patch Changes

0.44.5

Patch Changes

0.44.4

Patch Changes

0.44.3

Patch Changes

0.44.2

Patch Changes

0.44.1

Patch Changes

0.44.0

Patch Changes

0.43.3

Patch Changes

0.43.2

Patch Changes

  • #3569 06989e9 Thanks @IMax153! - Ensure QuitException terminates command-line processing.

    A QuitException raised by a Prompt that is executing as a fallback for a CLI option will terminate processing of the command line.

0.43.1

Patch Changes

  • #3561 2df49c4 Thanks @IMax153! - Add Options.withFallbackPrompt to CLI

    You can now specify that a command-line option should fallback to prompting the user for a value if no value is specified.

    import * as Options from "@effect/cli/Options"
    import * as Prompt from "@effect/cli/Prompt"
    
    const name = Options.text("name").pipe(
      Options.withFallbackPrompt(
        Prompt.text({
          message: "Please provide your name"
        })
      )
    )
    

0.43.0

Patch Changes

0.42.3

Patch Changes

0.42.2

Patch Changes

0.42.1

Patch Changes

0.42.0

Patch Changes

0.41.5

Patch Changes

0.41.4

Patch Changes

0.41.3

Patch Changes

0.41.2

Patch Changes

0.41.1

Patch Changes

0.41.0

Patch Changes

0.40.8

Patch Changes

0.40.7

Patch Changes

0.40.6

Patch Changes

0.40.5

Patch Changes

0.40.4

Patch Changes

0.40.3

Patch Changes

0.40.2

Patch Changes

0.40.1

Patch Changes

0.40.0

Patch Changes

0.39.3

Patch Changes

0.39.2

Patch Changes

0.39.1

Patch Changes

  • #3329 b8e3ab6 Thanks @IMax153! - The Prompt.all method now supports taking in a record of Prompts to be more consistent with other all APIs throughout the Effect ecosystem.

    You can now do:

    import * as Prompt from "@effect/cli/Prompt"
    import * as NodeContext from "@effect/platform-node/NodeContext"
    import * as Runtime from "@effect/platform-node/NodeRuntime"
    import * as Effect from "effect/Effect"
    
    const program = Prompt.all({
      username: Prompt.text({
        message: "Enter your username"
      }),
      password: Prompt.password({
        message: "Enter your password: ",
        validate: (value) =>
          value.length === 0
            ? Effect.fail("Password cannot be empty")
            : Effect.succeed(value)
      })
    })
    
    program.pipe(
      Effect.flatMap(({ username, password }) => /* Your logic here */ ),
      Effect.provide(NodeContext.layer),
      NodeRuntime.runMain
    )
    
  • #3332 c8f8690 Thanks @IMax153! - improve the Prompt.all JSDoc and add example

  • Updated dependencies [f241154]:

0.39.0

Patch Changes

0.38.3

Patch Changes

0.38.2

Patch Changes

0.38.1

Patch Changes

0.38.0

Patch Changes

0.37.10

Patch Changes

0.37.9

Patch Changes

0.37.8

Patch Changes

0.37.7

Patch Changes

0.37.6

Patch Changes

0.37.5

Patch Changes

0.37.4

Patch Changes

0.37.3

Patch Changes

0.37.2

Patch Changes

  • #3167 749b903 Thanks @IMax153! - ensure that file selector properly traverses up directories

0.37.1

Patch Changes

0.37.0

Minor Changes

  • #3153 51bb7d5 Thanks @IMax153! - Refactors the Prompt.custom constructor to make it easier to create custom Prompts.

    The Prompt.custom constructor allows for creation of a custom Prompt from the provided initial state and handlers.

    export const custom: <State, Output>(
      initialState: State | Effect<State, never, Prompt.Environment>,
      handlers: {
        readonly render: (
          state: State,
          action: Action<State, Output>
        ) => Effect<string, never, Environment>
        readonly process: (
          input: UserInput,
          state: State
        ) => Effect<Action<State, Output>, never, Environment>
        readonly clear: (
          state: State,
          action: Action<State, Output>
        ) => Effect<string, never, Environment>
      }
    ) => Prompt<Output> = InternalPrompt.custom
    

    The initial state of a Prompt can either be a pure value or an Effect. This is particularly useful when the initial state of the Prompt must be computed by performing some effectful computation, such as reading data from the file system.

    A Prompt is essentially a render loop where user input triggers a new frame to be rendered to the Terminal. The handlers of a custom prompt are used to control what is rendered to the Terminal each frame. During each frame, the following occurs:

    1. The render handler is called with this frame's prompt state and prompt action and returns an ANSI escape string to be rendered to the Terminal
    2. The Terminal obtains input from the user
    3. The process handler is called with the input obtained from the user and this frame's prompt state and returns the next prompt action that should be performed
    4. The clear handler is called with this frame's prompt state and prompt action and returns an ANSI escape string used to clear the screen of the Terminal
  • #3153 51bb7d5 Thanks @IMax153! - Utilize the Prompt.file constructor in Effect CLI's wizard mode for file and directory Options

  • #3153 51bb7d5 Thanks @IMax153! - Adds a Prompt.file constructor to the Prompt module which allows the user to select a file

0.36.72

Patch Changes

0.36.71

Patch Changes

0.36.70

Patch Changes

0.36.69

Patch Changes

0.36.68

Patch Changes

0.36.67

Patch Changes

0.36.66

Patch Changes

0.36.65

Patch Changes

0.36.64

Patch Changes

0.36.63

Patch Changes

0.36.62

Patch Changes

0.36.61

Patch Changes

0.36.60

Patch Changes

0.36.59

Patch Changes

0.36.58

Patch Changes

0.36.57

Patch Changes

0.36.56

Patch Changes

0.36.55

Patch Changes

0.36.54

Patch Changes

0.36.53

Patch Changes

0.36.52

Patch Changes

0.36.51

Patch Changes

0.36.50

Patch Changes

0.36.49

Patch Changes

0.36.48

Patch Changes

0.36.47

Patch Changes

0.36.46

Patch Changes

0.36.45

Patch Changes

0.36.44

Patch Changes

0.36.43

Patch Changes

0.36.42

Patch Changes

0.36.41

Patch Changes

0.36.40

Patch Changes

0.36.39

Patch Changes

0.36.38

Patch Changes

0.36.37

Patch Changes

0.36.36

Patch Changes

0.36.35

Patch Changes

0.36.34

Patch Changes

0.36.33

Patch Changes

0.36.32

Patch Changes

0.36.31

Patch Changes

0.36.30

Patch Changes

0.36.29

Patch Changes

0.36.28

Patch Changes

0.36.27

Patch Changes

0.36.26

Patch Changes

0.36.25

Patch Changes

0.36.24

Patch Changes

0.36.23

Patch Changes

0.36.22

Patch Changes

0.36.21

Patch Changes

0.36.20

Patch Changes

0.36.19

Patch Changes

0.36.18

Patch Changes

0.36.17

Patch Changes

0.36.16

Patch Changes

0.36.15

Patch Changes

0.36.14

Patch Changes

0.36.13

Patch Changes

0.36.12

Patch Changes

0.36.11

Patch Changes

0.36.10

Patch Changes

0.36.9

Patch Changes

0.36.8

Patch Changes

0.36.7

Patch Changes

0.36.6

Patch Changes

0.36.5

Patch Changes

0.36.4

Patch Changes

0.36.3

Patch Changes

0.36.2

Patch Changes

0.36.1

Patch Changes

0.36.0

Minor Changes

Patch Changes

0.35.31

Patch Changes

0.35.30

Patch Changes

0.35.29

Patch Changes

0.35.28

Patch Changes

0.35.27

Patch Changes

0.35.26

Patch Changes

0.35.25

Patch Changes

0.35.24

Patch Changes

0.35.23

Patch Changes

0.35.22

Patch Changes

0.35.21

Patch Changes

0.35.20

Patch Changes

0.35.19

Patch Changes

0.35.18

Patch Changes

0.35.17

Patch Changes

0.35.16

Patch Changes

0.35.15

Patch Changes

0.35.14

Patch Changes

0.35.13

Patch Changes

0.35.12

Patch Changes

0.35.11

Patch Changes

0.35.10

Patch Changes

0.35.9

Patch Changes

0.35.8

Patch Changes

0.35.7

Patch Changes

0.35.6

Patch Changes

0.35.5

Patch Changes

0.35.4

Patch Changes

0.35.3

Patch Changes

0.35.2

Patch Changes

0.35.1

Patch Changes

0.35.0

Minor Changes

Patch Changes

0.34.3

Patch Changes

0.34.2

Patch Changes

0.34.1

Patch Changes

0.34.0

Minor Changes

  • #2101 a025b12 Thanks @github-actions! - Swap type params of Either from Either<E, A> to Either<R, L = never>.

    Along the same line of the other changes this allows to shorten the most common types such as:

    import { Either } from "effect"
    
    const right: Either.Either<string> = Either.right("ok")
    

Patch Changes

0.33.14

Patch Changes

0.33.13

Patch Changes

0.33.12

Patch Changes

0.33.11

Patch Changes

0.33.10

Patch Changes

0.33.9

Patch Changes

0.33.8

Patch Changes

0.33.7

Patch Changes

0.33.6

Patch Changes

0.33.5

Patch Changes

0.33.4

Patch Changes

0.33.3

Patch Changes

0.33.2

Patch Changes

0.33.1

Patch Changes

0.33.0

Minor Changes

  • #2006 9a2d1c1 Thanks @github-actions! - With this change we now require a string key to be provided for all tags and renames the dear old Tag to GenericTag, so when previously you could do:

    import { Effect, Context } from "effect"
    interface Service {
      readonly _: unique symbol
    }
    const Service = Context.Tag<
      Service,
      {
        number: Effect.Effect<never, never, number>
      }
    >()
    

    you are now mandated to do:

    import { Effect, Context } from "effect"
    interface Service {
      readonly _: unique symbol
    }
    const Service = Context.GenericTag<
      Service,
      {
        number: Effect.Effect<never, never, number>
      }
    >("Service")
    

    This makes by default all tags globals and ensures better debuggaility when unexpected errors arise.

    Furthermore we introduce a new way of constructing tags that should be considered the new default:

    import { Effect, Context } from "effect"
    class Service extends Context.Tag("Service")<
      Service,
      {
        number: Effect.Effect<never, never, number>
      }
    >() {}
    
    const program = Effect.flatMap(Service, ({ number }) => number).pipe(
      Effect.flatMap((_) => Effect.log(`number: ${_}`))
    )
    

    this will use "Service" as the key and will create automatically an opaque identifier (the class) to be used at the type level, it does something similar to the above in a single shot.

  • #2006 1a77f72 Thanks @github-actions! - change Effect type parameters order from Effect<R, E, A> to Effect<A, E = never, R = never>

  • #2006 a34dbdc Thanks @github-actions! - - Schema: change type parameters order from Schema<R, I, A> to Schema<A, I = A, R = never>

    • Serializable: change type parameters order from Serializable<R, I, A> to Serializable<A, I, R>
    • Class: change type parameters order from Class<R, I, A, C, Self, Inherited> to Class<A, I, R, C, Self, Inherited>
    • PropertySignature: change type parameters order from PropertySignature<R, From, FromIsOptional, To, ToIsOptional> to PropertySignature<From, FromIsOptional, To, ToIsOptional, R = never>
  • #2006 b1e2086 Thanks @github-actions! - remove re-exports from platform packages

  • #2006 02c3461 Thanks @github-actions! - With this change we remove the Data.Data type and we make Equal.Equal & Hash.Hash implicit traits.

    The main reason is that Data.Data<A> was structurally equivalent to A & Equal.Equal but extending Equal.Equal doesn't mean that the equality is implemented by-value, so the type was simply adding noise without gaining any level of safety.

    The module Data remains unchanged at the value level, all the functions previously available are supposed to work in exactly the same manner.

    At the type level instead the functions return Readonly variants, so for example we have:

    import { Data } from "effect"
    
    const obj = Data.struct({
      a: 0,
      b: 1
    })
    

    will have the obj typed as:

    declare const obj: {
      readonly a: number
      readonly b: number
    }
    
  • #2006 9a2d1c1 Thanks @github-actions! - This change enables Effect.serviceConstants and Effect.serviceMembers to access any constant in the service, not only the effects, namely it is now possible to do:

    import { Effect, Context } from "effect"
    
    class NumberRepo extends Context.TagClass("NumberRepo")<
      NumberRepo,
      {
        readonly numbers: Array<number>
      }
    >() {
      static numbers = Effect.serviceConstants(NumberRepo).numbers
    }
    

Patch Changes

0.32.2

Patch Changes

0.32.1

Patch Changes

0.32.0

Minor Changes

  • #2047 eb1f787 Thanks @tim-smart! - make array types in cli more permissive

    This change removes NonEmpty* arrays as input parameters, and removes use of ReadonlyArray as a return type (prefering Array instead).

    This allows more interop with the existing js ecosystem.

0.31.9

Patch Changes

0.31.8

Patch Changes

0.31.7

Patch Changes

0.31.6

Patch Changes

0.31.5

Patch Changes

0.31.4

Patch Changes

0.31.3

Patch Changes

  • #1990 003bb69 Thanks @IMax153! - fix stack overflow exception when nesting cli options / args in a command config

0.31.2

Patch Changes

0.31.1

Patch Changes

0.31.0

Minor Changes

  • #1984 eaab2e8 Thanks @IMax153! - default Options.repeated to return an empty array if option is not provided

Patch Changes

  • #1980 9cf3782 Thanks @IMax153! - fix CLI argument parsing to properly handle the case when a repeated option is not provided

0.30.6

Patch Changes

0.30.5

Patch Changes

0.30.4

Patch Changes

0.30.3

Patch Changes

0.30.2

Patch Changes

0.30.1

Patch Changes

0.30.0

Minor Changes

  • #1938 9a0d61f Thanks @IMax153! - rename mapOrFail to mapEffect for Command, Options, and Args modules

0.29.0

Minor Changes

  • #1925 86180cc Thanks @IMax153! - adds optional executable parameter to CliApp.make

    NOTE: This means that users are no longer required to manually remove the executable from the CLI arguments (i.e. process.argv.slice(2)). The executable is stripped from the CLI arguments internally within CliApp.make, so all command-line arguments can be provided directly to the CLI application.

Patch Changes

0.28.9

Patch Changes

0.28.8

Patch Changes

0.28.7

Patch Changes

0.28.6

Patch Changes

0.28.5

Patch Changes

0.28.4

Patch Changes

0.28.3

Patch Changes

0.28.2

Patch Changes

0.28.1

Patch Changes

0.28.0

Minor Changes

Patch Changes

0.27.0

Minor Changes

0.26.0

Minor Changes

0.25.4

Patch Changes

0.25.3

Patch Changes

0.25.2

Patch Changes

0.25.1

Patch Changes

  • #422 ca7dcd5 Thanks @tim-smart! - add Command.withHandler,transformHandler,provide,provideEffectDiscard

0.25.0

Minor Changes

Patch Changes

  • #411 07b3529 Thanks @IMax153! - default CliConfig.finalCheckBuiltIn to false

  • #404 70fc225 Thanks @IMax153! - remove "type" option from Prompt.text and add Prompt.password and Prompt.hidden which return Secret

  • #416 234c3f7 Thanks @IMax153! - Make help documentation print built-in options by default

    The printing of built-in options in the help documentation can be disabled by providing a custom CliConfig to your CLI application with showBuiltIns set to false.

0.24.0

Minor Changes

Patch Changes

0.23.1

Patch Changes

0.23.0

Minor Changes

Patch Changes

0.22.0

Minor Changes

0.21.0

Minor Changes

Patch Changes

  • #358 07eaa9d Thanks @IMax153! - add support for auto-generating completions for a cli program

0.20.1

Patch Changes

0.20.0

Minor Changes

0.19.0

Minor Changes

0.18.0

Minor Changes

0.17.0

Minor Changes

0.16.0

Minor Changes

Patch Changes

0.15.1

Patch Changes

0.15.0

Minor Changes

0.14.0

Minor Changes

0.13.0

Minor Changes

0.12.0

Minor Changes

0.11.0

Minor Changes

0.10.1

Patch Changes

0.10.0

Minor Changes

Patch Changes

0.9.0

Minor Changes

0.8.0

Minor Changes

0.7.0

Minor Changes

0.6.0

Minor Changes

0.5.0

Minor Changes

Patch Changes

0.4.1

Patch Changes

0.4.0

Minor Changes

0.3.0

Minor Changes

Patch Changes

0.2.0

Minor Changes

Patch Changes

0.1.0

Minor Changes

0.0.1

Patch Changes