Project repo-family relations from local declarations
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s

This commit is contained in:
codex 2026-07-26 08:51:29 +02:00
parent 1d8f59f1de
commit 9af9ee3e72
13 changed files with 671 additions and 28 deletions

View file

@ -450,6 +450,7 @@ def _registry_sync(args: argparse.Namespace) -> int:
{
"slug": repo_slug,
"name": args.name or repo_path.name,
"path": str(repo_path),
"remote_url": args.remote_url or _git_value(repo_path, "config", "--get", "remote.origin.url"),
"default_branch": args.default_branch,
"state_hub_repo_id": args.state_hub_repo_id,
@ -457,6 +458,7 @@ def _registry_sync(args: argparse.Namespace) -> int:
"ownership_repo": args.ownership_repo,
"primary_rail": args.primary_rail,
"supported_rails": args.supported_rail,
"declaration_paths": [str(path.resolve()) for path in args.paths],
"substrate_kind": args.substrate_kind,
},
)
@ -834,7 +836,7 @@ def _scan_manifest_repo(
repository = _registry_post_checked(
registry_url,
"/repositories",
_manifest_repository_payload(item, repo_path, slug),
_manifest_repository_payload(item, repo_path, slug, manifest_dir),
)
stored = _registry_post_checked(
registry_url,
@ -1234,7 +1236,7 @@ def _sync_manifest_repo(registry_url: str, manifest_dir: Path, item: object) ->
repository = _registry_post_checked(
registry_url,
"/repositories",
_manifest_repository_payload(item, repo_path, slug),
_manifest_repository_payload(item, repo_path, slug, manifest_dir),
)
result["repository"] = repository
except RegistryRequestError as exc:
@ -1595,10 +1597,21 @@ def _manifest_optional_path(value: object, manifest_dir: Path) -> Path | None:
return path if path.is_absolute() else (manifest_dir / path).resolve()
def _manifest_repository_payload(item: dict[str, Any], repo_path: Path | None, slug: str) -> dict[str, Any]:
def _manifest_repository_payload(
item: dict[str, Any],
repo_path: Path | None,
slug: str,
manifest_dir: Path | None = None,
) -> dict[str, Any]:
declaration_paths = (
[str(path) for path in _manifest_paths(item.get("declaration_paths"), manifest_dir)]
if manifest_dir is not None
else []
)
return {
"slug": slug,
"name": item.get("name") or (repo_path.name if repo_path else slug),
"path": str(repo_path) if repo_path is not None else None,
"remote_url": item.get("remote_url") or _git_value(repo_path, "config", "--get", "remote.origin.url"),
"default_branch": item.get("default_branch") or "main",
"state_hub_repo_id": item.get("state_hub_repo_id"),
@ -1606,6 +1619,7 @@ def _manifest_repository_payload(item: dict[str, Any], repo_path: Path | None, s
"ownership_repo": item.get("ownership_repo"),
"primary_rail": item.get("primary_rail"),
"supported_rails": item.get("supported_rails"),
"declaration_paths": declaration_paths,
"substrate_kind": item.get("substrate_kind"),
}