Resolve backend inventory from checkout
This commit is contained in:
@@ -54,7 +54,7 @@ def main() -> int:
|
||||
args = parser.parse_args()
|
||||
|
||||
catalog = json.loads((META_ROOT / "repositories.json").read_text(encoding="utf-8"))
|
||||
workspace_root = Path(catalog["default_parent"]).resolve()
|
||||
workspace_root = _resolve_workspace_root(catalog)
|
||||
webui = _extract_webui()
|
||||
backend_endpoints = _extract_backend_endpoints(catalog, workspace_root)
|
||||
manifests = _extract_manifests(catalog, workspace_root)
|
||||
@@ -103,6 +103,27 @@ def main() -> int:
|
||||
return 0
|
||||
|
||||
|
||||
def _resolve_workspace_root(catalog: dict[str, Any]) -> Path:
|
||||
sibling_root = META_ROOT.parent.resolve()
|
||||
configured_root = Path(str(catalog["default_parent"])).expanduser().resolve()
|
||||
repositories = catalog.get("repositories")
|
||||
if not isinstance(repositories, list):
|
||||
raise ValueError("repository catalog has no repositories array")
|
||||
|
||||
def source_count(root: Path) -> int:
|
||||
return sum(
|
||||
1
|
||||
for item in repositories
|
||||
if isinstance(item, dict)
|
||||
and isinstance(item.get("path"), str)
|
||||
and (root / item["path"] / "src").is_dir()
|
||||
)
|
||||
|
||||
sibling_count = source_count(sibling_root)
|
||||
configured_count = source_count(configured_root)
|
||||
return sibling_root if sibling_count >= configured_count else configured_root
|
||||
|
||||
|
||||
def _extract_webui() -> dict[str, Any]:
|
||||
helper = META_ROOT / "tools" / "inventory" / "extract-webui-structure.mjs"
|
||||
completed = subprocess.run(
|
||||
|
||||
Reference in New Issue
Block a user