# `GitHoox.Installer`
[🔗](https://github.com/sgerrand/git_hoox/blob/v0.5.0/lib/git_hoox/installer.ex#L1)

Manage `.git/hooks/*` shim files.

Refuses to overwrite user-authored hooks. Pass `force: true` to back up
and replace. Detects own shims by `# git_hoox managed` marker.

# `action`

```elixir
@type action() :: :write | :overwrite_managed | :overwrite_with_backup
```

Per-hook installer plan entry.

# `install_error`

```elixir
@type install_error() :: :not_a_git_repo | {:exists, Path.t(), String.t()}
```

# `plan_entry`

```elixir
@type plan_entry() :: {String.t(), Path.t(), action()}
```

# `scaffold_error`

```elixir
@type scaffold_error() :: {:config_exists, Path.t()} | {non_neg_integer(), String.t()}
```

# `config_filename`

```elixir
@spec config_filename() :: String.t()
```

Name of the per-repo config file.

# `hook_names`

```elixir
@spec hook_names() :: [String.t()]
```

Kebab-case names of every git stage git_hoox manages.

# `install`

```elixir
@spec install(keyword()) :: {:ok, [plan_entry()]} | {:error, install_error()}
```

Install hook shims into `.git/hooks/`.

## Options

  * `:force` — overwrite user hooks with backup. Default `false`.
  * `:dry_run` — print plan, no writes. Default `false`.
  * `:auto_deps_get` — prepend a `mix deps.get` self-heal line to each
    shim. Default `false`.

# `managed?`

```elixir
@spec managed?(Path.t()) :: boolean()
```

True if the file at `path` is a git_hoox-managed shim.

# `scaffold`

```elixir
@spec scaffold(keyword()) :: {:ok, Path.t()} | {:error, scaffold_error()}
```

Write a starter `.git_hoox.exs` at the repo root.

## Options

  * `:force` — overwrite existing config. Default `false`.

Returns `{:ok, path}` on success or `{:error, {:config_exists, path}}`
if the file already exists and `:force` is false.

# `uninstall`

```elixir
@spec uninstall(keyword()) :: {:ok, non_neg_integer()}
```

Remove managed shims. Restore latest backup if present.

---

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