Fastwhisper / app /paths.py
Mbonea's picture
Ship Plan timeline with thick feedback, priors, and P1 Seligman scope lock.
c6253b2
Raw
History Blame Contribute Delete
1.75 kB
"""Define and initialize all durable filesystem paths.
Only this module decides where application data files live.
"""
from dataclasses import dataclass
from pathlib import Path
@dataclass(frozen=True)
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))
@property
def config(self) -> Path:
return self.root / "config.json"
@property
def entries(self) -> Path:
return self.root / "entries.jsonl"
@property
def daily(self) -> Path:
return self.root / "daily.jsonl"
@property
def traces(self) -> Path:
return self.root / "traces.jsonl"
@property
def coach_brief(self) -> Path:
return self.root / "coach_brief.md"
@property
def schedule_dir(self) -> Path:
return self.root / "schedule"
@property
def schedule_priors(self) -> Path:
return self.schedule_dir / "priors.json"
@property
def schedule_feedback(self) -> Path:
return self.schedule_dir / "feedback.jsonl"
@property
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)