- harness/es.py: append-only event store + проекции (образец — кооп-портал) - harness/levels.py: уровни 1с/1м/1ч/1д, контекст ∝ масштабу - harness/scheduler.py: уровневые потоки, идемпотентные тики, absorbed-стабы - harness/isolated_runner.py + _llm_worker.py: LLM-тик в сабпроцессе (глобальный asyncio-рантайм Strands не переживает 2+ create_harness) - cli.py: init/task/tasks/status/events + requeue (написан самим минутным агентом) - 9router: отдельный ключ sk-simbiot, модель auto (glm-5.3 первым)
27 lines
809 B
Python
27 lines
809 B
Python
"""Git utilities, adopted from mypy's git utilities (https://github.com/python/mypy/blob/master/mypy/git.py)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
|
|
def is_git_repo(dir: Path) -> bool:
|
|
"""Is the given directory version-controlled with git?"""
|
|
return dir.joinpath('.git').exists()
|
|
|
|
|
|
def have_git() -> bool: # pragma: no cover
|
|
"""Can we run the git executable?"""
|
|
try:
|
|
subprocess.check_output(['git', '--help'])
|
|
return True
|
|
except subprocess.CalledProcessError:
|
|
return False
|
|
except OSError:
|
|
return False
|
|
|
|
|
|
def git_revision(dir: Path) -> str:
|
|
"""Get the SHA-1 of the HEAD of a git repository."""
|
|
return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'], cwd=dir).decode('utf-8').strip()
|