# `MingaEditor.Extension.GitStatus`
[🔗](https://github.com/jsmestad/minga/blob/main/sdk/lib/minga_editor/extension/git_status.ex#L1)

Enables the native Git Status sidebar for an extension.

Minga owns the sidebar and its cached repository snapshot. Extensions own
commit prompts and Git operations. The SDK declares the API for compilation;
the editor provides the runtime.

# `commit_target`

```elixir
@type commit_target() ::
  {:ok, String.t(), String.t() | nil} | :not_git | :repo_unavailable
```

The displayed repository and last commit message, or why no target is available.

# `prepare_commit`

```elixir
@spec prepare_commit(MingaEditor.Extension.EditorAPI.state()) ::
  {MingaEditor.Extension.EditorAPI.state(), commit_target()}
```

Shows Git Status and returns the exact displayed repository and last commit message.

Returns `:not_git` outside a repository, or `:repo_unavailable` with a
notice in the returned state when Git Status cannot provide a commit target.

# `register`

```elixir
@spec register() :: :ok | {:error, term()}
```

Registers the unique native surface. Call this from the extension's `init/1`.

# `toggle`

```elixir
@spec toggle(MingaEditor.Extension.EditorAPI.state()) ::
  MingaEditor.Extension.EditorAPI.state()
```

Opens, focuses, or closes Git Status. Does nothing when the surface is unavailable.

---

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