""" title: Gitea Coder - Workflow Role with Scope Enforcement author: Jeff Smith + Claude + minimax version: 1.0.1 license: MIT description: High-level workflow role for LLM-based code generation with scope gating and quality gates requirements: pydantic, httpx changelog: 1.0.1: - Fixed: moved difflib import to module level (was incorrectly inside function) - difflib is Python stdlib, no pip install required 1.0.0: - Initial implementation of gitea_coder role - Branch creation with scope gating (prevents main pushes) - Enforces branch naming conventions (feature/, fix/, refactor/, etc.) - Generates detailed commit messages with ticket references - Creates PRs from branches - Reads ticket requirements from issues - Unified file operations workflow - Added diff-based updates with apply_diff() - Added size delta gating in commit_changes() for quality control """ from typing import Optional, Callable, Any, Dict, List, Tuple from pydantic import BaseModel, Field import re import time import base64 import difflib import httpx