Run every tool's git through git_repo.git, with rule-hook's guards as an option

This commit is contained in:
2026-10-21 19:35:15 +02:00
parent 583b85eea8
commit a261669735
15 changed files with 116 additions and 110 deletions
+6 -2
View File
@@ -6,6 +6,9 @@ import termios
import time
import typing
from failure import Failure
import git_repo
# Seconds before a Python script loop-claude runs is stopped, so a hung one, such as chunk-preflight, cannot hold the loop.
PYTHON_TIMEOUT = 600
@@ -25,7 +28,8 @@ class Effects:
# Drops what was typed on the terminal and not yet read.
discard_typed: typing.Callable[[], None]
execv: typing.Callable[[str, list[str]], None]
git: typing.Callable[[list[str], str], subprocess.CompletedProcess[str]]
# Runs git as git_repo.git does.
git: typing.Callable[..., str | Failure]
input: typing.Callable[[str], str]
local_time: typing.Callable[[float], str]
now: typing.Callable[[], float]
@@ -54,7 +58,7 @@ def system_effects() -> Effects:
claude_on_terminal=lambda args, cwd, env: subprocess.run(["claude", *args], cwd=cwd, env={**os.environ, **env}).returncode,
discard_typed=lambda: termios.tcflush(sys.stdin, termios.TCIFLUSH),
execv=os.execv,
git=lambda args, cwd: subprocess.run(["git", *args], capture_output=True, cwd=cwd, text=True),
git=git_repo.git,
input=input,
local_time=lambda seconds: time.strftime("%Y-%m-%d %H:%M %Z", time.localtime(seconds)),
now=time.time,