# `MingaAgent.ProjectView.Backend`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_agent/project_view/backend.ex#L1)

Behaviour for workspace project view backends.

Backends implement file access for one workspace-local view. Callers use `MingaAgent.ProjectView`; backend modules stay hidden behind the facade.

# `capabilities`

```elixir
@type capabilities() :: %{
  isolation: :none | :overlay,
  mutates_project_root: boolean(),
  supports_promote: boolean(),
  supports_discard: boolean(),
  supports_command_env: boolean()
}
```

Backend capability flags.

# `directory_entry`

```elixir
@type directory_entry() :: %{name: String.t(), type: :file | :directory}
```

Directory listing entry.

# `ref`

```elixir
@type ref() :: term()
```

Backend-owned reference, usually a pid or small state map.

# `capabilities`

```elixir
@callback capabilities(MingaAgent.ProjectView.t()) :: capabilities()
```

# `close`

```elixir
@callback close(MingaAgent.ProjectView.t()) :: :ok | {:error, term()}
```

# `command_env`

```elixir
@callback command_env(MingaAgent.ProjectView.t()) ::
  [{String.t(), String.t()}] | {:error, term()}
```

# `delete_file`

```elixir
@callback delete_file(MingaAgent.ProjectView.t(), String.t()) :: :ok | {:error, term()}
```

# `diff`

```elixir
@callback diff(MingaAgent.ProjectView.t()) :: {:ok, [map()]} | {:error, term()}
```

# `discard`

```elixir
@callback discard(MingaAgent.ProjectView.t()) :: :ok | {:error, term()}
```

# `discard_file`

```elixir
@callback discard_file(MingaAgent.ProjectView.t(), String.t()) :: :ok | {:error, term()}
```

# `edit_file`

```elixir
@callback edit_file(MingaAgent.ProjectView.t(), String.t(), String.t(), String.t()) ::
  :ok | {:error, term()}
```

# `list_directory`

```elixir
@callback list_directory(MingaAgent.ProjectView.t(), String.t()) ::
  {:ok, [directory_entry()]} | {:error, term()}
```

# `promote`

```elixir
@callback promote(MingaAgent.ProjectView.t(), term()) ::
  :ok | {:conflict, map()} | {:error, term()}
```

# `read_file`

```elixir
@callback read_file(MingaAgent.ProjectView.t(), String.t()) ::
  {:ok, binary()} | {:error, term()}
```

# `working_dir`

```elixir
@callback working_dir(MingaAgent.ProjectView.t()) :: String.t() | {:error, term()}
```

# `write_file`

```elixir
@callback write_file(MingaAgent.ProjectView.t(), String.t(), binary()) ::
  :ok | {:error, term()}
```

---

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