fix(ci): fix black/ruff failures, add CoC and PR template

- Fix Python formatting (sync no longer strips blank lines from .py files)
- Remove test_community_build.py (tests private sync module)
- Fix ruff warnings in test files
- Add CODE_OF_CONDUCT.md
- Add .github/PULL_REQUEST_TEMPLATE.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
airano
2026-02-17 18:19:39 +03:30
parent c9083d86b1
commit c73e39f6e4
135 changed files with 1185 additions and 317 deletions

View File

@@ -12,6 +12,7 @@ from typing import Any
from plugins.directus.client import DirectusClient
def _parse_json_param(value: Any, param_name: str = "parameter") -> Any:
"""Parse a parameter that may be a JSON string or already a native type."""
if value is None:
@@ -27,6 +28,7 @@ def _parse_json_param(value: Any, param_name: str = "parameter") -> Any:
raise ValueError(f"Invalid JSON in '{param_name}': {e}")
return value
def get_tool_specifications() -> list[dict[str, Any]]:
"""Return tool specifications for ToolGenerator (12 tools)"""
return [
@@ -241,10 +243,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
},
]
# =====================
# HANDLER FUNCTIONS
# =====================
async def list_files(
client: DirectusClient,
filter: dict | None = None,
@@ -269,6 +273,7 @@ async def list_files(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_file(client: DirectusClient, id: str) -> str:
"""Get file metadata."""
try:
@@ -279,6 +284,7 @@ async def get_file(client: DirectusClient, id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def update_file(client: DirectusClient, id: str, data: dict[str, Any]) -> str:
"""Update file metadata."""
try:
@@ -293,6 +299,7 @@ async def update_file(client: DirectusClient, id: str, data: dict[str, Any]) ->
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_file(client: DirectusClient, id: str) -> str:
"""Delete a file."""
try:
@@ -301,6 +308,7 @@ async def delete_file(client: DirectusClient, id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_files(client: DirectusClient, ids: list[str]) -> str:
"""Delete multiple files."""
try:
@@ -311,6 +319,7 @@ async def delete_files(client: DirectusClient, ids: list[str]) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def import_file_url(client: DirectusClient, url: str, data: dict | None = None) -> str:
"""Import file from URL."""
try:
@@ -325,6 +334,7 @@ async def import_file_url(client: DirectusClient, url: str, data: dict | None =
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_file_url(client: DirectusClient, id: str, download: bool = False) -> str:
"""Get file URL."""
try:
@@ -336,6 +346,7 @@ async def get_file_url(client: DirectusClient, id: str, download: bool = False)
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def list_folders(
client: DirectusClient,
filter: dict | None = None,
@@ -361,6 +372,7 @@ async def list_folders(
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def get_folder(client: DirectusClient, id: str) -> str:
"""Get folder details."""
try:
@@ -371,6 +383,7 @@ async def get_folder(client: DirectusClient, id: str) -> str:
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def create_folder(client: DirectusClient, name: str, parent: str | None = None) -> str:
"""Create a folder."""
try:
@@ -383,6 +396,7 @@ async def create_folder(client: DirectusClient, name: str, parent: str | None =
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def update_folder(client: DirectusClient, id: str, data: dict[str, Any]) -> str:
"""Update folder."""
try:
@@ -397,6 +411,7 @@ async def update_folder(client: DirectusClient, id: str, data: dict[str, Any]) -
except Exception as e:
return json.dumps({"success": False, "error": str(e)}, indent=2)
async def delete_folder(client: DirectusClient, id: str) -> str:
"""Delete a folder."""
try: