# `Minga.Extension.Updater`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga/extension/updater.ex#L1)

Orchestrates extension update checks, application, and rollback.

The update lifecycle has two phases:

1. **Check** (background Task): fetch remote changes for all extensions,
   build a list of available updates, and send it to the Editor to
   enter confirmation mode.

2. **Apply** (after user confirms): for each accepted update, fast-forward
   git repos or reinstall hex packages, recompile, and rollback on failure.

All check functions run in a background `Task` so they don't block the
editor. Results are communicated back via `Minga.Events` broadcasts.

# `update_result`

```elixir
@type update_result() ::
  {:updated, atom(), String.t(), String.t()}
  | {:up_to_date, atom()}
  | {:rolled_back, atom(), String.t()}
  | {:error, atom(), String.t()}
```

Result of a single extension update attempt.

# `apply_accepted`

```elixir
@spec apply_accepted(Minga.Mode.ExtensionConfirmState.t()) :: :ok
```

Applies the accepted updates from the confirmation dialog.

Takes the confirmation state and applies updates for each accepted index.
Runs in a background Task. Results are posted to *Messages*.

# `check_all`

```elixir
@spec check_all() :: :ok
```

Checks for updates on all extensions and sends results to the Editor
for confirmation. Designed to run in a background Task.

Fetches remote changes for git extensions and checks version info for
hex extensions, then sends an `:extension_updates_available` message
to the Editor with the update list.

# `check_single`

```elixir
@spec check_single(atom()) :: :ok
```

Checks for updates on a single extension by name and sends results
to the Editor for confirmation. Designed to run in a background Task.

# `details`

```elixir
@spec details(atom()) :: String.t()
```

Gets the git log details for an extension (for the `d` key in confirmation).

Returns a formatted string of recent commit messages.

---

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