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.
Summary
Types
Backend capability flags.
Directory listing entry.
Backend-owned reference, usually a pid or small state map.
Types
@type capabilities() :: %{ isolation: :none | :overlay, mutates_project_root: boolean(), supports_promote: boolean(), supports_discard: boolean(), supports_command_env: boolean() }
Backend capability flags.
@type directory_entry() :: %{name: String.t(), type: :file | :directory}
Directory listing entry.
@type ref() :: term()
Backend-owned reference, usually a pid or small state map.
Callbacks
@callback capabilities(MingaAgent.ProjectView.t()) :: capabilities()
@callback close(MingaAgent.ProjectView.t()) :: :ok | {:error, term()}
@callback command_env(MingaAgent.ProjectView.t()) :: [{String.t(), String.t()}] | {:error, term()}
@callback delete_file(MingaAgent.ProjectView.t(), String.t()) :: :ok | {:error, term()}
@callback diff(MingaAgent.ProjectView.t()) :: {:ok, [map()]} | {:error, term()}
@callback discard(MingaAgent.ProjectView.t()) :: :ok | {:error, term()}
@callback discard_file(MingaAgent.ProjectView.t(), String.t()) :: :ok | {:error, term()}
@callback edit_file(MingaAgent.ProjectView.t(), String.t(), String.t(), String.t()) :: :ok | {:error, term()}
@callback list_directory(MingaAgent.ProjectView.t(), String.t()) :: {:ok, [directory_entry()]} | {:error, term()}
@callback promote(MingaAgent.ProjectView.t(), term()) :: :ok | {:conflict, map()} | {:error, term()}
@callback read_file(MingaAgent.ProjectView.t(), String.t()) :: {:ok, binary()} | {:error, term()}
@callback working_dir(MingaAgent.ProjectView.t()) :: String.t() | {:error, term()}
@callback write_file(MingaAgent.ProjectView.t(), String.t(), binary()) :: :ok | {:error, term()}