(_args: argparse.Namespace)
| 353 | |
| 354 | |
| 355 | def 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 | |
| 392 | def cmd_evidence(args: argparse.Namespace) -> int: |
nothing calls this directly
no test coverage detected