- Implemented PluginBlocks component to render various plugin UI elements. - Created SuitePicker for selecting test suites and questions. - Introduced usePluginUI hook for managing plugin UI state and manifest. - Developed DocsPage for comprehensive plugin framework documentation. - Added PluginPage to render pages declared by plugins based on the current path.
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
import os
|
|
import shutil
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT_DIR = Path(__file__).resolve().parent.parent
|
|
CORE_DIR = ROOT_DIR / ".core"
|
|
TESTS_DIR = ROOT_DIR / "tests"
|
|
# Built-in suites ship with the app and are read-only at runtime. Custom
|
|
# suites live under TESTS_DIR as sibling directories, one per slug.
|
|
BUILTIN_SUITES_DIR = CORE_DIR / "suites"
|
|
RESULTS_DIR = ROOT_DIR / "results"
|
|
TEMPLATES_DIR = CORE_DIR / "templates"
|
|
TEMPLATE_PATH = TEMPLATES_DIR / "test-block.md"
|
|
TEMP_DIR = CORE_DIR / ".temp"
|
|
MODELS_DIR = ROOT_DIR / "models"
|
|
|
|
DEFAULT_TEMPERATURE = float(os.getenv("AUTO_TEST_TEMPERATURE", "0.1"))
|
|
DEFAULT_PROVIDER_NAME = os.getenv("AUTO_TEST_PROVIDER", "Local Engine")
|
|
|
|
|
|
def ensure_directories() -> None:
|
|
"""Ensure that shared directories exist."""
|
|
RESULTS_DIR.mkdir(parents=True, exist_ok=True)
|
|
TEMPLATES_DIR.mkdir(parents=True, exist_ok=True)
|
|
TEMP_DIR.mkdir(parents=True, exist_ok=True)
|
|
MODELS_DIR.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
def get_env_setting(key: str, default: str) -> str:
|
|
"""Read an environment variable with a default fallback."""
|
|
return os.getenv(key, default)
|
|
|
|
|
|
def reset_temp_directory() -> None:
|
|
"""Clear and recreate the temporary directory used for staging markdown blocks."""
|
|
if TEMP_DIR.exists():
|
|
shutil.rmtree(TEMP_DIR)
|
|
TEMP_DIR.mkdir(parents=True, exist_ok=True)
|