# `ComposerNew.Plan`
[🔗](https://github.com/elixir-composer/composer/blob/v0.3.0/lib/composer_new/plan.ex#L1)

Turns `mix composer.new` argv into the list of commands to run.

`build/2` is pure: everything it needs from the outside (the working
directory, the home directory, the archive's version) comes in `env`,
so `--dry-run` prints exactly what a run executes, and the tests check
the same lists. The commands, in order (`[...]` is optional):

    rm -rf APP                                              (--reset)
    mix igniter.new APP --no-git --yes [--local REL] [--with TASK]
        [--with-args=ARGS] [--install PKG,...]
    (in APP) mix igniter.install composer@SRC[,COOKBOOK[@SRC]][,EXTRA,...]
        --only dev,test --yes
    (in APP) git init
    (in APP) git add -A
    (in APP) git commit -m "mix composer.new <argv as typed>"
    (in APP) mix composer.recipe.run COOKBOOK:GROUP/RECIPE [FLAGS]
                                             (REF given, no --no-recipe)

`igniter.new` gets `--no-git`, so the history starts with the commit
above rather than with igniter's own. `git init` is harmless in a repo
the base generator already made, so it is always planned.

`path:` sources are made absolute, since the install runs inside APP.
The commit message keeps the argv as typed.

# `env`

```elixir
@type env() :: %{cwd: Path.t(), home: Path.t(), version: String.t()}
```

# `step`

```elixir
@type step() :: ComposerNew.Command.t() | {:rm_rf, Path.t()}
```

# `t`

```elixir
@type t() :: %ComposerNew.Plan{
  commands: [step()],
  parsed: ComposerNew.Argv.t(),
  summary: map()
}
```

# `build`

```elixir
@spec build([String.t()], env()) :: {:ok, t()} | {:error, String.t()}
```

Builds the plan for `argv`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
