Expand description
Git Helper Functions
Provides git hooks management, a git wrapper for blocking commits during the agent phase, and basic repository utilities.
Core git operations use libgit2 directly. Agent-phase defense-in-depth may also install a temporary PATH wrapper that intercepts the git CLI when available.
§Module Structure
runtime/hooks- Git hooks installation and removal (boundary module)identity- Git identity resolution with comprehensive fallback chainrepo- Basic git repository operations (add, commit, snapshot)start_commit- Starting commit tracking for incremental diffsreview_baseline- Per-review-cycle baseline trackingruntime/wrapper- Agent phase git wrapper for safe concurrent execution (boundary module)branch- Branch detection and default branch resolutionrebase- Rebase operations with fault tolerance
Re-exports§
pub use branch::get_default_branch;pub use branch::is_main_or_master_branch;pub use hooks::install_hooks_in_repo;pub use hooks::reinstall_hooks_if_tampered;pub use hooks::uninstall_hooks;pub use hooks::uninstall_hooks_in_repo;pub use hooks::uninstall_hooks_silent_in_hooks_dir;pub use hooks::verify_hooks_removed;pub use hooks::HOOK_MARKER;pub use hooks::RALPH_HOOK_NAMES;pub use rebase::abort_rebase;pub use rebase::continue_rebase;pub use rebase::get_conflict_markers_for_file;pub use rebase::get_conflicted_files;pub use rebase::rebase_in_progress;pub use rebase::rebase_onto;pub use rebase::RebaseResult;pub use rebase::RebaseErrorKind;pub use wrapper::capture_head_oid;pub use wrapper::cleanup_agent_phase_protections_silent_at;pub use wrapper::cleanup_agent_phase_silent;pub use wrapper::cleanup_agent_phase_silent_at;pub use wrapper::cleanup_orphaned_marker;pub use wrapper::cleanup_orphaned_wrapper_at;pub use wrapper::clear_agent_phase_global_state;pub use wrapper::disable_git_wrapper;pub use wrapper::end_agent_phase;pub use wrapper::end_agent_phase_in_repo;pub use wrapper::ensure_agent_phase_protections;pub use wrapper::start_agent_phase;pub use wrapper::start_agent_phase_in_repo;pub use wrapper::try_remove_ralph_dir;pub use wrapper::verify_ralph_dir_removed;pub use wrapper::verify_wrapper_cleaned;pub use wrapper::GitHelpers;pub use wrapper::ProtectionCheckResult;pub use wrapper::cleanup_orphaned_marker_with_workspace;pub use wrapper::create_marker_with_workspace;pub use wrapper::marker_exists_with_workspace;pub use wrapper::remove_marker_with_workspace;
Modules§
- branch
- Git branch detection and default branch resolution.
- cleanup
- config_
state - hooks
- Git hook installation and management.
- hooks_
dir - identity
- Git identity resolution with fallback chain.
- install
- lock
- marker
- path_
wrapper - phase
- phase_
state - Runtime module containing OS-boundary code (std::fs, std::process, std::env, Mutex). This module is exempt from functional Rust dylint rules.
- rebase
- Git rebase operations using libgit2 with Git CLI fallback.
- runtime
- Runtime primitives for git_helpers boundary module.
- runtime_
identity - script
- Git wrapper script generation for agent-phase commit protection.
- uninstall
- verify
- worktree
- wrapper
- Git wrapper for blocking commits during agent phase.
Structs§
- Diff
Review Content - The result of diff truncation for review purposes.
- Protection
Scope
Enums§
- Commit
Result Fallback - Result of commit operation with fallback.
- Diff
Truncation Level - The level of truncation applied to a diff for review.
- Review
Baseline - Start
Point
Functions§
- ensure_
local_ excludes - get_
baseline_ summary - get_
current_ head_ oid - Get the current HEAD commit OID.
- get_
current_ head_ oid_ at - Get the current HEAD commit OID for an explicit repository root.
- get_
git_ diff_ for_ review_ with_ workspace - Get the diff content that should be shown to reviewers.
- get_
git_ diff_ from_ start - Get the git diff from the starting commit.
- get_
git_ diff_ from_ start_ with_ workspace - Get the git diff from the starting commit (workspace-aware).
- get_
hooks_ dir - Errors
- get_
repo_ root - Get the git repository root.
- get_
review_ baseline_ info - get_
start_ commit_ summary - Get a summary of the start commit state for display.
- git_
add_ all - Stage all changes.
- git_
add_ all_ in_ repo - Stage all changes in the repository discovered from
repo_root. - git_
add_ specific_ in_ repo - Stage specific files for commit.
- git_
commit - Create a commit.
- git_
commit_ in_ repo - Create a commit in the repository discovered from
repo_root. - git_
diff - Get the diff of all changes (unstaged and staged).
- git_
diff_ from - Generate a diff from a specific starting commit.
- git_
diff_ in_ repo - Get the diff of all changes (unstaged and staged) by discovering from an explicit path.
- git_
oid_ to_ git2_ oid - git_
snapshot - Get a snapshot of the current git status.
- git_
snapshot_ in_ repo - Get a snapshot of git status for a specific repository root.
- load_
review_ baseline - load_
start_ point - Load the starting commit OID from the file.
- parse_
git_ status_ paths - Extract repo-relative paths from a porcelain v1-style status snapshot.
- require_
git_ repo - Check if we’re in a git repository.
- reset_
start_ commit - Reset the starting commit to merge-base with the default branch.
- resolve_
protection_ scope - Resolve the active git-protection scope for the current repository context.
- resolve_
protection_ scope_ from - save_
start_ commit - Save the current HEAD commit as the starting commit.
- save_
start_ commit_ with_ workspace - Save start commit using workspace abstraction.
- update_
review_ baseline - update_
review_ baseline_ with_ workspace