tools.git_repo_tools module

Git repository inspection tools: clone, pull, checkout, read, log, search, diff, list.

This module exposes a family of read-and-inspect Git tools to the bot. Every repository lives under BASE_GIT_PATH (/home/star/git) on the worker’s filesystem, and all operations are driven through GitPython (Repo) rather than shelling out. Repository names and file paths are validated to stay inside that base directory so a tool call can never traverse outside the sandbox, and clone URLs are restricted to https:// and git:// schemes.

The async handlers (_git_*) are registered via the module-level TOOLS list, which tool_loader.load_tools turns into ToolDefinition entries; the inference worker’s executor (openrouter_client.executor) later dispatches them by name with a ToolContext (ctx). These particular tools do not read from ctx – they work purely against the local clone directory – so the parameter is accepted and ignored. Results are always returned as JSON strings built with jsonutil so the model receives a structured payload.