GitCli.Worktree.Review behaviour (fnord v0.9.38)
View SourceFacade for the shared interactive flow for reviewing, merging, and
cleaning up a fnord-managed worktree. Used by both Cmd.Ask
(post-completion) and Cmd.Worktrees merge.
Includes pre-merge and post-merge validation gates that run the project's configured validation rules against the worktree (before merge) and the main checkout (after merge). Post-merge validation failure triggers an automatic revert, while merge command failures are returned to the caller.
Public functions dispatch through impl/0, resolved via the
:git_review Globals key and defaulting to
GitCli.Worktree.Review.Default. Tests do NOT point this key at a
mock by default; tests that script the review/merge outcome opt in
per test (see Fnord.TestCase.mock_git_review/0).
Summary
Functions
Merges worktree changes and cleans up without prompting. Runs validation before and after merge. Pre-merge validation failure blocks the merge.
Colorizes a unified diff string for terminal display.
Walks the user through inspecting the diff, merging, and optionally deleting the worktree and its local branch. Runs validation before and after merge.
Types
@type review_result() :: :ok | {:cleaned_up, merge_range(), :interactive | :auto} | {:validation_failed, :pre_merge | :post_merge, String.t()} | {:merge_failed, String.t()}
Callbacks
@callback auto_merge(String.t(), worktree_info(), keyword()) :: review_result()
@callback colorize_diff(String.t()) :: Owl.Data.t()
@callback interactive_review(String.t(), worktree_info(), keyword()) :: review_result()
Functions
@spec auto_merge(String.t(), worktree_info(), keyword()) :: review_result()
Merges worktree changes and cleans up without prompting. Runs validation before and after merge. Pre-merge validation failure blocks the merge.
@spec colorize_diff(String.t()) :: Owl.Data.t()
Colorizes a unified diff string for terminal display.
@spec impl() :: module()
@spec interactive_review(String.t(), worktree_info(), keyword()) :: review_result()
Walks the user through inspecting the diff, merging, and optionally deleting the worktree and its local branch. Runs validation before and after merge.