Updated
On this page
The git tool: read-only subcommands (status, diff, log, show, blame, branches, changed_files) run directly, while commit shells out to safegit for concurrency-safe mutation from a message-plus-file-paths args array.
#tool.src.orxtra.tool._git_tool
#tool.src.orxtra.tool._git_tool
#_run_git
python
async def _run_git(cmd: list[str], cwd: Path) -> tuple[str, str, int]Run a git subprocess and return (stdout, stderr, returncode).
Raises ToolError on timeout.
#_format_output
python
def _format_output(stdout: str, stderr: str, returncode: int) -> strFormat read-only command output. Returns stderr on failure.
#_handle_commit
python
async def _handle_commit(args: list[str], cwd: Path, run_context: dict[str, str] | None) -> strRun safegit commit. Raises ToolError on validation or exec failure.
#make_git_tool
python
def make_git_tool(read_root: Path, allowed_subcommands: list[str], run_context: dict[str, str] | None=None) -> ToolCreate a git tool with the specified allowed subcommands.
Args:
read_root: Working directory for git commands.allowed_subcommands: Which subcommands the agent may use.run_context: Optional key-value pairs added as trailers on commits.
Returns:
- A Tool instance for git operations.
Raises:
ValueError: If any allowed subcommand is not recognized.