17 lines
713 B
Python
17 lines
713 B
Python
|
|
"""API: Read audit status."""
|
||
|
|
from helpers.api import ApiHandler, Request, Response
|
||
|
|
import os
|
||
|
|
|
||
|
|
class AuditStatusGet(ApiHandler):
|
||
|
|
async def process(self, input: dict, request: Request) -> dict | Response:
|
||
|
|
project_root = input.get("project_root", os.getcwd())
|
||
|
|
audit_dir = os.path.join(project_root, ".a0", "audit")
|
||
|
|
audits = {}
|
||
|
|
if os.path.isdir(audit_dir):
|
||
|
|
for f in os.listdir(audit_dir):
|
||
|
|
if f.endswith(".md"):
|
||
|
|
path = os.path.join(audit_dir, f)
|
||
|
|
with open(path, "r") as fh:
|
||
|
|
audits[f] = fh.read()[:500] # first 500 chars
|
||
|
|
return {"ok": True, "audits": audits, "count": len(audits)}
|