intermediate commit
Some checks failed
Dependency Audit / dependency-audit (push) Failing after 16s
Security Audit / security-audit (push) Failing after 11s

This commit is contained in:
2026-07-14 13:32:09 +02:00
parent dd796b4d3c
commit 05ae81d641
58 changed files with 7526 additions and 66 deletions

View File

@@ -0,0 +1,59 @@
"""Workspace and repository configuration helpers."""
from __future__ import annotations
import json
from pathlib import Path
from .model import RepositorySpec
META_ROOT = Path(__file__).resolve().parents[3]
DEFAULT_WORKSPACE_ROOT = META_ROOT.parent
REPOSITORIES_FILE = META_ROOT / "repositories.json"
def load_repository_specs(*, include_website: bool = False) -> tuple[RepositorySpec, ...]:
payload = json.loads(REPOSITORIES_FILE.read_text(encoding="utf-8"))
repositories = payload.get("repositories")
if not isinstance(repositories, list):
raise ValueError(f"{REPOSITORIES_FILE} does not contain a repositories list")
specs: list[RepositorySpec] = []
for item in repositories:
if not isinstance(item, dict):
continue
category = str(item.get("category", ""))
if category == "website" and not include_website:
continue
specs.append(
RepositorySpec(
name=str(item["name"]),
category=category,
subtype=str(item.get("subtype", "")),
remote=str(item.get("remote", "")),
path=str(item["path"]),
)
)
return tuple(specs)
def resolve_workspace_root(value: Path | str | None = None) -> Path:
if value is None:
return DEFAULT_WORKSPACE_ROOT
return Path(value).expanduser().resolve()
def resolve_repo_path(spec: RepositorySpec, workspace_root: Path) -> Path:
path = Path(spec.path)
if path.is_absolute():
return path
return workspace_root / path
def core_root(workspace_root: Path) -> Path:
return workspace_root / "govoplan-core"
def website_root(workspace_root: Path) -> Path:
return workspace_root / "addideas-govoplan-website"