feat: model repo standards and detect prefix collisions

Implement RMGR-WP-0004 T01 (flavor, required files, anti-patterns from
canon) and T08 (prefix ownership registry plus uniqueness scan).
rmgr conform and rmgr prefix-uniqueness are detection only.
This commit is contained in:
tegwick 2026-08-18 13:28:40 +02:00
parent 106d7d5b2b
commit 04145a59d9
8 changed files with 640 additions and 4 deletions

View file

@ -64,6 +64,17 @@ def main(argv: list[str] | None = None) -> int:
add_rapp_parser(sub)
p_conf = sub.add_parser("conform", help="Check a repository against flavor standards")
p_conf.add_argument("--path", default=".", help="Repository checkout path")
p_conf.add_argument("--slug", default=None)
p_pref = sub.add_parser(
"prefix-uniqueness",
help="Detect shared workplan prefixes and reused identifiers (ADR-007)",
)
p_pref.add_argument("--root", default=".", help="Fleet root or a single repository")
p_pref.add_argument("--registry", default=None, help="Override prefix registry YAML")
args = parser.parse_args(argv)
if args.version or args.command in (None, "version"):
@ -188,6 +199,21 @@ def main(argv: list[str] | None = None) -> int:
print(json.dumps(result, indent=2))
return 0 if result.get("ok") else 1
if args.command == "conform":
from repo_manager.standards import check_repository
report = check_repository(Path(args.path), slug=args.slug)
print(json.dumps(report.to_dict(), indent=2))
return 0 if report.ok else 1
if args.command == "prefix-uniqueness":
from repo_manager.prefix_registry import scan_prefixes
registry = Path(args.registry) if args.registry else None
report = scan_prefixes(Path(args.root), registry_path=registry)
print(json.dumps(report, indent=2))
return 0 if report.get("ok") else 1
parser.print_help()
return 0