MingaEditor.State.WorkspaceReview (Minga v0.1.0)

Copy Markdown View Source

Review state for workspace-local agent drafts.

The state field is intentionally limited to stable states. Promote, apply, discard, and resolve are transitions, not stored states.

Summary

Functions

Marks draft work as ready for review, or clean when no drafts exist.

Records more draft edits while staying in draft mode.

Moves review or conflict work back to draft mode when an agent resumes.

Moves a clean workspace into draft mode.

Clears all draft and conflict metadata and returns to clean.

Returns the number of conflicting files.

Clears drafts or conflicts without applying them.

Discards one file from draft and conflict metadata.

Returns the number of changed draft files.

Marks the workspace as needing review, optionally recording an error.

Creates a clean review state.

Returns true when the review has unapplied drafts, conflicts, or a recorded error.

Marks an overlap detected during promote.

Marks a successful promote as clean.

Marks conflicts as resolved and promoted.

Sets changed files without changing the stable state.

Types

error()

@type error() :: term()

state()

@type state() :: :clean | :draft | :needs_review | :conflict

t()

@type t() :: %MingaEditor.State.WorkspaceReview{
  changed_files: [Minga.Project.FileRef.t()],
  conflict_files: [Minga.Project.FileRef.t()],
  in_progress?: boolean(),
  last_error: error() | nil,
  state: state()
}

Functions

agent_completed(review, files)

@spec agent_completed(t(), [Minga.Project.FileRef.t()]) ::
  {:ok, t()} | {:error, term()}

Marks draft work as ready for review, or clean when no drafts exist.

agent_made_more_edits(review, files)

@spec agent_made_more_edits(t(), [Minga.Project.FileRef.t()]) ::
  {:ok, t()} | {:error, term()}

Records more draft edits while staying in draft mode.

agent_resumed(review)

@spec agent_resumed(t()) :: {:ok, t()} | {:error, term()}

Moves review or conflict work back to draft mode when an agent resumes.

agent_started_editing(review, files)

@spec agent_started_editing(t(), [Minga.Project.FileRef.t()]) ::
  {:ok, t()} | {:error, term()}

Moves a clean workspace into draft mode.

clean(review)

@spec clean(t()) :: t()

Clears all draft and conflict metadata and returns to clean.

conflict_count(workspace_review)

@spec conflict_count(t()) :: non_neg_integer()

Returns the number of conflicting files.

discard(review)

@spec discard(t()) :: {:ok, t()} | {:error, term()}

Clears drafts or conflicts without applying them.

discard_file(review, file_ref)

@spec discard_file(t(), Minga.Project.FileRef.t()) :: t()

Discards one file from draft and conflict metadata.

draft_count(workspace_review)

@spec draft_count(t()) :: non_neg_integer()

Returns the number of changed draft files.

mark_needs_review(review, files, error \\ nil)

@spec mark_needs_review(t(), [Minga.Project.FileRef.t()], error() | nil) :: t()

Marks the workspace as needing review, optionally recording an error.

new()

@spec new() :: t()

Creates a clean review state.

pending?(workspace_review)

@spec pending?(t()) :: boolean()

Returns true when the review has unapplied drafts, conflicts, or a recorded error.

promote_found_overlaps(review, files, error)

@spec promote_found_overlaps(t(), [Minga.Project.FileRef.t()], term()) ::
  {:ok, t()} | {:error, term()}

Marks an overlap detected during promote.

promote_succeeded(review)

@spec promote_succeeded(t()) :: {:ok, t()} | {:error, term()}

Marks a successful promote as clean.

resolved_and_promoted(review)

@spec resolved_and_promoted(t()) :: {:ok, t()} | {:error, term()}

Marks conflicts as resolved and promoted.

set_changed_files(review, files)

@spec set_changed_files(t(), [Minga.Project.FileRef.t()]) :: t()

Sets changed files without changing the stable state.