mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-10 22:47:14 +01:00
Python 3.14 stdlib package wiring git to the todo MCP server: - closer (post-commit): runs the done_check of each Todo: trailer task and close_task's it only on exit 0. It FAILS OPEN: the commit already happened, so a down server, bad token or no gh prints one warning and exits 0 instead of failing the hook. - sweep: nightly drift report (systemd units shipped, not enabled). - import-pr: a merged PR's '## Todo:' items become tasks, deduped. - A done_check runs only if its sha256 is in ~/.config/todo-hooks/trusted-checks; 'Check: manual' notes are never auto-closed. - Hooks exposed in .pre-commit-hooks.yaml (post-commit, post-merge, post-rewrite). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
735 B
Python
26 lines
735 B
Python
"""Helpers shared by the PR import tests."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from todo_hooks.tests._fakes import FakeClient
|
|
from todo_hooks.tests.conftest import git
|
|
|
|
if TYPE_CHECKING:
|
|
from collections.abc import Callable
|
|
from pathlib import Path
|
|
|
|
|
|
def search_client(existing: str = "no tasks match") -> FakeClient:
|
|
return FakeClient({"search_tasks": existing, "add_task": "added x"})
|
|
|
|
|
|
def pr_repo(make_repo: Callable[..., Path], n: int = 2) -> Path:
|
|
root = make_repo("demo", origin="git@github.com:kuhyx/demo.git")
|
|
for i in range(n):
|
|
(root / f"g{i}").write_text("x")
|
|
git(root, "add", f"g{i}")
|
|
git(root, "commit", "-q", "-m", f"c{i}")
|
|
return root
|