Ports dirigent's gitea scripts into a self-contained reliquary plugin. Scripts run via uv with PEP 723 inline deps — no project venv needed. Gitea connection inferred from `git remote get-url origin` with env-var overrides; only GITEA_TOKEN is mandatory. Workpad path and tickets directory are parameterized so the plugin works in any project. Label set externalized to labels.default.json with project-level override via .gitea-labels.json. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
34 lines
876 B
Python
34 lines
876 B
Python
#!/usr/bin/env python3
|
|
# /// script
|
|
# requires-python = ">=3.11"
|
|
# dependencies = ["httpx", "pydantic>=2", "python-dotenv"]
|
|
# ///
|
|
"""Verify Gitea connectivity. Exits 0 on success, 1 on any failure."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
|
|
from client import GiteaClient, GiteaError
|
|
from config import load_config
|
|
|
|
|
|
def main() -> None:
|
|
config = load_config()
|
|
print(f"Gitea URL : {config.base_url}")
|
|
print(f"Repo : {config.owner}/{config.repo}")
|
|
try:
|
|
with GiteaClient(config) as client:
|
|
if client.test_connection():
|
|
print("Connection: OK")
|
|
return
|
|
print("Connection: FAIL (repo not accessible)", file=sys.stderr)
|
|
sys.exit(1)
|
|
except GiteaError as e:
|
|
print(f"Connection: FAIL ({e})", file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|