agent-todo-tracker/agent_todos/gitea.py

27 lines
822 B
Python

from __future__ import annotations
from typing import Iterable
from .models import Priority, Status, Todo
def repo_labels(todos: Iterable[Todo]) -> dict[str, list[str]]:
grouped: dict[str, list[str]] = {}
for todo in todos:
grouped.setdefault(todo.repo, []).append(todo.title)
return grouped
def gitea_issue_payload(todo: Todo, org: str = "stackchain") -> dict:
title = f"TODO: {todo.title}"
labels = [todo.priority.value, todo.status.value]
labels.extend(todo.tags)
body = (
f"**Status:** {todo.status.value}\n"
f"**Priority:** {todo.priority.value}\n"
f"**Repo:** {todo.repo}\n"
f"**Assignee:** {todo.assignee or 'unassigned'}\n\n"
"Auto-generated by agent-todo-tracker."
)
return {"title": title, "body": body, "labels": labels}