feat: delegate project register; registrar-only ID minting
STATE-WP-0080-T02: statehub register routes project-flavor scaffolding through rmgr scaffold and keeps only repo + host-path registration. T01 refuse remains when GOAL.md is missing and --wp-prefix is not set. RMGR-WP-0005-T01: C-06/C-11/C-32 skip mint+writeback unless this instance is the identifier registrar (STATEHUB_REGISTRAR or railiance hostname).
This commit is contained in:
parent
71ad6c5d17
commit
d8e0eddb22
6 changed files with 419 additions and 25 deletions
|
|
@ -249,6 +249,55 @@ def rm_update_task_status(
|
|||
return result
|
||||
|
||||
|
||||
def rm_scaffold(
|
||||
*,
|
||||
repo_path: str | Path,
|
||||
flavor: str,
|
||||
wp_prefix: str | None = None,
|
||||
slug: str | None = None,
|
||||
domain: str = "infotech",
|
||||
force: bool = False,
|
||||
commit: bool = False,
|
||||
) -> dict[str, Any]:
|
||||
"""Delegate repository scaffolding to ``rmgr scaffold`` (STATE-WP-0080-T02)."""
|
||||
args = [
|
||||
"scaffold",
|
||||
"--path",
|
||||
str(repo_path),
|
||||
"--flavor",
|
||||
flavor,
|
||||
"--domain",
|
||||
domain,
|
||||
]
|
||||
if slug:
|
||||
args.extend(["--slug", slug])
|
||||
if wp_prefix:
|
||||
args.extend(["--wp-prefix", wp_prefix])
|
||||
if force:
|
||||
args.append("--force")
|
||||
if not commit:
|
||||
args.append("--no-commit")
|
||||
code, out, err = run_rmgr(args)
|
||||
try:
|
||||
result = json.loads(out.strip() or "{}")
|
||||
except json.JSONDecodeError:
|
||||
result = {
|
||||
"status": "failed",
|
||||
"error": {
|
||||
"code": "internal",
|
||||
"message": f"rmgr non-json exit={code} stderr={err!r} stdout={out[:500]!r}",
|
||||
},
|
||||
}
|
||||
if code != 0 and result.get("status") not in ("applied", "rejected"):
|
||||
result.setdefault("status", "failed")
|
||||
result.setdefault(
|
||||
"error",
|
||||
{"code": "internal", "message": f"rmgr exit={code} stderr={err!r}"},
|
||||
)
|
||||
result["exit_code"] = code
|
||||
return result
|
||||
|
||||
|
||||
def rm_reconcile(*, repo_path: str | Path, repo_slug: str | None = None) -> dict[str, Any]:
|
||||
args = ["reconcile", "--path", str(repo_path)]
|
||||
if repo_slug:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue