Coverage for src \ truenex_memory \ export \ exporter.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-05-19 10:21 +0200

1"""JSON export helpers.""" 

2 

3from __future__ import annotations 

4 

5from pathlib import Path 

6import json 

7 

8from truenex_memory.core.memory_service import MemoryService 

9 

10 

11def export_memory(output: Path, *, project_root: Path | str = ".") -> Path: 

12 """Write a local memory export JSON file.""" 

13 

14 service = MemoryService(project_root) 

15 service.init_project() 

16 output.parent.mkdir(parents=True, exist_ok=True) 

17 output.write_text(json.dumps(service.repository.export_data(), indent=2, sort_keys=True), encoding="utf-8") 

18 return output