Spaces:
Sleeping
Sleeping
| """Define and initialize all durable filesystem paths. | |
| Only this module decides where application data files live. | |
| """ | |
| from dataclasses import dataclass | |
| from pathlib import Path | |
| class Paths: | |
| """Concrete files rooted below the configured data directory.""" | |
| root: Path | |
| def __init__(self, root: str | Path) -> None: | |
| object.__setattr__(self, "root", Path(root)) | |
| def config(self) -> Path: | |
| return self.root / "config.json" | |
| def entries(self) -> Path: | |
| return self.root / "entries.jsonl" | |
| def daily(self) -> Path: | |
| return self.root / "daily.jsonl" | |
| def traces(self) -> Path: | |
| return self.root / "traces.jsonl" | |
| def coach_brief(self) -> Path: | |
| return self.root / "coach_brief.md" | |
| def schedule_dir(self) -> Path: | |
| return self.root / "schedule" | |
| def schedule_priors(self) -> Path: | |
| return self.schedule_dir / "priors.json" | |
| def schedule_feedback(self) -> Path: | |
| return self.schedule_dir / "feedback.jsonl" | |
| def schedule_meta(self) -> Path: | |
| return self.schedule_dir / "meta.json" | |
| def plan_path(self, day: str) -> Path: | |
| """Return the JSON path for one calendar day's plan.""" | |
| return self.schedule_dir / f"plan-{day}.json" | |
| def ensure(self) -> None: | |
| """Create the data directory and initial empty JSONL files.""" | |
| self.root.mkdir(parents=True, exist_ok=True) | |
| self.schedule_dir.mkdir(parents=True, exist_ok=True) | |
| for path in (self.entries, self.daily, self.traces, self.schedule_feedback): | |
| path.touch(exist_ok=True) | |