MCPcopy Create free account
hub / github.com/Open-Quant/openquant / cmd_export

Function cmd_export

scripts/afml_docs_loop.py:355–389  ·  view source on GitHub ↗
(_args: argparse.Namespace)

Source from the content-addressed store, hash-verified

353
354
355def cmd_export(_args: argparse.Namespace) -> int:
356 state = read_state()
357
358 export = {
359 "generatedAt": state.get("updated_at", now_iso()),
360 "chapters": [],
361 }
362 for chapter in state["chapters"]:
363 export["chapters"].append(
364 {
365 "chapter": chapter["chapter"],
366 "theme": chapter["theme"],
367 "status": recompute_chapter_status(chapter),
368 "chunkCount": chapter.get("chunk_count", 0),
369 "sections": [
370 {
371 "id": section["id"],
372 "module": section["module"],
373 "slug": section["slug"],
374 "status": section["status"],
375 }
376 for section in chapter["sections"]
377 ],
378 }
379 )
380
381 body = (
382 "// Generated by scripts/afml_docs_loop.py export. Do not edit manually.\n"
383 f"export const afmlDocsState = {json.dumps(export, indent=2)} as const;\n"
384 "export type AfmlDocsState = typeof afmlDocsState;\n"
385 )
386 ASTRO_AFML_DATA_PATH.parent.mkdir(parents=True, exist_ok=True)
387 ASTRO_AFML_DATA_PATH.write_text(body, encoding="utf-8")
388 print(f"Exported Astro AFML docs state: {ASTRO_AFML_DATA_PATH}")
389 return 0
390
391
392def cmd_evidence(args: argparse.Namespace) -> int:

Callers

nothing calls this directly

Calls 4

read_stateFunction · 0.85
now_isoFunction · 0.85
recompute_chapter_statusFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected