feat: add scoped identifier registrar
This commit is contained in:
parent
859df9aae7
commit
2bf569d3d5
6 changed files with 435 additions and 2 deletions
|
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from repo_manager.commands.rapp import add_rapp_parser
|
||||
|
|
@ -45,6 +46,24 @@ def main(argv: list[str] | None = None) -> int:
|
|||
p_rec.add_argument("--slug", default=None)
|
||||
p_rec.add_argument("--no-write-index", action="store_true", help="Do not write index file")
|
||||
|
||||
p_registrar = sub.add_parser(
|
||||
"registrar-reconcile",
|
||||
help="Assign missing State Hub UUIDs through a scoped on-demand registrar",
|
||||
)
|
||||
p_registrar.add_argument("--path", default=".", help="Repository checkout path")
|
||||
p_registrar.add_argument(
|
||||
"--api-base",
|
||||
default=os.environ.get("STATE_HUB_API_BASE", "http://127.0.0.1:8000"),
|
||||
help="Authoritative State Hub API base",
|
||||
)
|
||||
p_registrar.add_argument("--statehub-bin", default=None, help="Override statehub executable")
|
||||
p_registrar.add_argument(
|
||||
"--confirm-primary",
|
||||
action="store_true",
|
||||
help="Confirm that --api-base is the authoritative hub",
|
||||
)
|
||||
p_registrar.add_argument("--push", action="store_true", help="Push the registrar commit")
|
||||
|
||||
p_cmd = sub.add_parser(
|
||||
"update-task-status",
|
||||
help="Command repo.work.update_task_status (file + git commit)",
|
||||
|
|
@ -236,6 +255,19 @@ def main(argv: list[str] | None = None) -> int:
|
|||
print(json.dumps({"ok": True, "snapshot": snap, "index": index.to_dict()}, indent=2))
|
||||
return 0
|
||||
|
||||
if args.command == "registrar-reconcile":
|
||||
from repo_manager.commands.registrar_reconcile import registrar_reconcile
|
||||
|
||||
result = registrar_reconcile(
|
||||
Path(args.path),
|
||||
api_base=args.api_base,
|
||||
statehub_bin=args.statehub_bin,
|
||||
confirm_primary=args.confirm_primary,
|
||||
push=args.push,
|
||||
)
|
||||
print(json.dumps(result.to_dict(), indent=2))
|
||||
return 0 if result.status in {"applied", "noop"} else 1
|
||||
|
||||
if args.command == "update-task-status":
|
||||
from repo_manager.commands.task_status import update_task_status
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue