feat: make Core reports commercially production-ready
This commit is contained in:
@@ -24,6 +24,11 @@ from local_report import (
|
||||
report_html,
|
||||
run_report,
|
||||
)
|
||||
from readiness import (
|
||||
assess as assess_readiness,
|
||||
configure_domain,
|
||||
discover as discover_project,
|
||||
)
|
||||
|
||||
|
||||
def find_root(start: str) -> Path:
|
||||
@@ -302,6 +307,21 @@ def parser() -> argparse.ArgumentParser:
|
||||
latest = commands.add_parser("latest", help="show the latest finalized prompt receipt")
|
||||
latest.add_argument("--json", action="store_true")
|
||||
|
||||
readiness = commands.add_parser(
|
||||
"readiness",
|
||||
help="assess Core, Domain Pipeline, and Provider Telemetry separately",
|
||||
)
|
||||
readiness.add_argument("--refresh", action="store_true")
|
||||
readiness.add_argument("--json", action="store_true")
|
||||
|
||||
domain = commands.add_parser(
|
||||
"domain",
|
||||
help="discover or select an optional project-owned Domain Pack manifest",
|
||||
)
|
||||
domain.add_argument("action", choices=["status", "discover", "configure"])
|
||||
domain.add_argument("manifest", nargs="?")
|
||||
domain.add_argument("--json", action="store_true")
|
||||
|
||||
view = commands.add_parser("view", help="open a trace in the local Core viewer")
|
||||
view.add_argument("trace_id", nargs="?")
|
||||
view.add_argument("--no-open", action="store_true")
|
||||
@@ -333,6 +353,51 @@ def main(argv=None) -> int:
|
||||
print(json.dumps(receipt, ensure_ascii=False, indent=2))
|
||||
return 0 if receipt else 1
|
||||
return print_receipt(receipt, root)
|
||||
if args.command == "readiness":
|
||||
result = assess_readiness(root, persist=args.refresh)
|
||||
if args.json:
|
||||
print(json.dumps(result, ensure_ascii=False, indent=2))
|
||||
else:
|
||||
dimensions = result["dimensions"]
|
||||
print(f"CASAN readiness — {result['project_id']}")
|
||||
print(f" Core {dimensions['core']['status']}")
|
||||
print(f" Domain Pipeline {dimensions['domain_pipeline']['status']}")
|
||||
print(f" Provider Telemetry {dimensions['provider_telemetry']['status']}")
|
||||
for action in result.get("next_actions", []):
|
||||
print(f" → {action['message']}")
|
||||
return 2 if result["overall_status"] == "blocked" else 0
|
||||
if args.command == "domain":
|
||||
try:
|
||||
if args.action == "discover":
|
||||
payload = discover_project(root)
|
||||
elif args.action == "configure":
|
||||
if not args.manifest:
|
||||
raise ValueError(
|
||||
"`casan domain configure` requires a manifest path")
|
||||
configure_domain(root, args.manifest)
|
||||
payload = assess_readiness(root, persist=True)
|
||||
else:
|
||||
payload = assess_readiness(root, persist=False)[
|
||||
"dimensions"]["domain_pipeline"]
|
||||
except ValueError as error:
|
||||
print(f"CASAN_DOMAIN_INVALID — {error}", file=sys.stderr)
|
||||
return 2
|
||||
if args.json:
|
||||
print(json.dumps(payload, ensure_ascii=False, indent=2))
|
||||
elif args.action == "discover":
|
||||
print("CASAN Domain discovery")
|
||||
print(
|
||||
f" Manifests {len(payload['project_manifest_candidates'])}")
|
||||
print(f" Domain Packs {len(payload['domain_pack_candidates'])}")
|
||||
print(f" Requirements {len(payload['requirements_candidates'])}")
|
||||
else:
|
||||
dimension = (
|
||||
payload["dimensions"]["domain_pipeline"]
|
||||
if "dimensions" in payload else payload
|
||||
)
|
||||
print(f"CASAN Domain Pipeline — {dimension['status']}")
|
||||
print(f" {dimension['summary']}")
|
||||
return 0
|
||||
if args.command == "viewer":
|
||||
return viewer_command(root, args.action, args.port, args.no_open)
|
||||
if args.command == "export":
|
||||
|
||||
Reference in New Issue
Block a user