oct
Loading...
Searching...
No Matches
oct.audit.oct_audit Namespace Reference

Classes

class  AuditResult

Functions

AuditResult run_audit (Path project_root)
None audit (click.Context ctx, bool as_json)

Variables

dict _STAGE_EXIT_CODES

Detailed Description

Purpose
-------
FS-539 / FS-501 (stub) - ``oct audit`` reads ``oc_status.json`` and
reports the project's Option C compliance stage.

This is the minimal landing surface that ``CLAUDE.md``'s compliance
probe and CI scripts consume. The full audit suite (schema drift,
scaffold age, doc/version mismatch, MCP readiness) lands in Phase 6.

Responsibilities
----------------
- Locate the project root and read ``oc_status.json`` from the
  ``.option_c/`` directory when one exists.
- Map the recorded ``stage`` onto the process exit code below, so a CI
  script or the ``CLAUDE.md`` compliance probe can branch on it without
  parsing text.
- Report the stage in human-readable form, or as JSON under
  ``--json-output`` for machine consumers.
- Treat an absent ``oc_status.json`` as a distinct outcome (exit 3)
  rather than an error: an unmigrated project is a legitimate state.

Exit codes
----------
    0  - compliant
    1  - migrating
    2  - bootstrap
    3  - no oc_status.json found (unmigrated project)

Diagnostics
-----------
Domain: AUDIT
Levels:
    L1 - errors: none; an unreadable or absent status file is exit 3
    L2 - lifecycle: audit entry and the resolved stage
    L3 - semantic: the status path probed and the stage read from it
    L4 - deep tracing: the raw status payload

Contracts
---------
- Read-only against the project tree; never writes.
- Exit code is derived from ``oc_status.json`` ``stage`` (or 3 when absent).

Dependencies
------------
- oct.core.diagnostics (_dbg structured logger)
- oct.core.option_c_dir (load_oc_status, option_c_dir)
- oct.core.project_root (project root detection)
- click (CLI framework)

Function Documentation

◆ audit()

None oct.audit.oct_audit.audit ( click.Context ctx,
bool as_json )
Report Option C compliance stage (stub for FS-501).

Definition at line 125 of file oct_audit.py.

Here is the call graph for this function:

◆ run_audit()

AuditResult oct.audit.oct_audit.run_audit ( Path project_root)
Read ``oc_status.json`` and return structured audit information.

Definition at line 87 of file oct_audit.py.

Here is the caller graph for this function:

Variable Documentation

◆ _STAGE_EXIT_CODES

dict oct.audit.oct_audit._STAGE_EXIT_CODES
protected
Initial value:
1= {
2 "compliant": 0,
3 "migrating": 1,
4 "bootstrap": 2,
5}

Definition at line 69 of file oct_audit.py.