release: dev → main #54

Merged
Eleboba merged 62 commits from dev into main 2026-10-22 17:50:43 +03:00
4 changed files with 31 additions and 3 deletions
Showing only changes of commit 595368b0a2 - Show all commits
+2 -1
View File
@@ -24,5 +24,6 @@ build/
.claude/worktrees/
.DS_Store
# local SQLite DB (bot without Docker)
# local run without Docker: SQLite DB, uploads clone, demo repo
*.db
data/
+16 -1
View File
@@ -1,4 +1,4 @@
.PHONY: install lint fmt typecheck test cov up down logs ps
.PHONY: install lint fmt typecheck test cov up down logs ps run demo-repo
install:
uv sync
@@ -30,3 +30,18 @@ logs:
ps:
docker compose ps
# Run the bot on this machine without Docker: SQLite (./tgit.db) and the settings from .env
run:
uv run python -m app
# A local uploads repo seeded from the template — try the bot without SourceCraft:
# make demo-repo → put the printed GIT_UPLOADS_URL into .env → make run
DEMO_REPO := $(CURDIR)/data/demo-uploads.git
demo-repo:
@test ! -e $(DEMO_REPO) || { echo "$(DEMO_REPO) already exists"; exit 1; }
@rm -rf data/demo-seed && mkdir -p data && cp -r infra/uploads-template data/demo-seed
@cd data/demo-seed && git init -q -b main && git add -A \
&& git -c user.name=tgit-bot -c user.email=tgit-bot@users.noreply.tgit commit -qm "init: uploads template"
@git clone -q --bare data/demo-seed $(DEMO_REPO) && rm -rf data/demo-seed
@echo "GIT_UPLOADS_URL=$(DEMO_REPO)"
+2 -1
View File
@@ -47,7 +47,8 @@ class CommitInfo:
class UploadsRepo:
def __init__(self, settings: GitSettings) -> None:
self._s = settings
self._dir = settings.clone_dir
# absolute: git clone runs from the parent dir, a relative path would land one level deeper
self._dir = settings.clone_dir.resolve()
self._lock = asyncio.Lock()
self._fetched_at: float | None = None
self._key_path = self._materialize_key()
+11
View File
@@ -83,3 +83,14 @@ async def test_unreachable_remote(tmp_path: Path) -> None:
broken = UploadsRepo(GitSettings(uploads_url=str(tmp_path / "missing.git"), clone_dir=tmp_path / "c3"))
with pytest.raises(GitError, match="clone"):
await broken.refresh()
async def test_relative_clone_dir(remote: Path, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
from app.config import GitSettings
monkeypatch.chdir(tmp_path)
relative = UploadsRepo(GitSettings(uploads_url=str(remote), clone_dir=Path("data/uploads")))
await relative.refresh()
assert (tmp_path / "data" / "uploads" / ".git").is_dir()
assert "README.md" in [e.name for e in await relative.list_dir()]