73 """Read ``oc_status.json`` and return structured audit information."""
75 _dbg(
"AUDIT", func, f
"start root={project_root}", 2)
77 status = load_oc_status(project_root)
82 f
"no oc_status.json; .option_c exists={has_dotdir}",
89 oct_version_at_migration=
"",
93 exit_code = _STAGE_EXIT_CODES.get(status.stage, 3)
94 _dbg(
"AUDIT", func, f
"end stage={status.stage} exit={exit_code}", 2)
98 pillars=status.pillars,
99 migrated_from=status.migrated_from,
100 oct_version_at_migration=status.oct_version_at_migration,
108@click.option("--json-output", "as_json", is_flag=True, help="Emit JSON instead of human-readable text.")
110def audit(ctx, as_json: bool):
111 """Report Option C compliance stage (stub for FS-501)."""
112 project_root = get_project_root(ctx)
117 "stage": result.stage,
118 "pillars": result.pillars,
119 "migrated_from": result.migrated_from,
120 "oct_version_at_migration": result.oct_version_at_migration,
121 "exit_code": result.exit_code,
123 click.echo(json.dumps(payload, indent=2))
125 if result.stage
is None:
126 click.echo(
"Stage: unmigrated (no .option_c/oc_status.json)")
128 click.echo(f
"Stage: {result.stage}")
129 for name, info
in result.pillars.items():
130 enabled = info.get(
"enabled",
False)
131 marker =
"+" if enabled
else "-"
132 click.echo(f
" [{marker}] {name}")
133 if result.migrated_from:
134 click.echo(
"Migrated from:")
135 for label, src
in result.migrated_from.items():
136 click.echo(f
" {label}: {src}")
138 raise SystemExit(result.exit_code)