🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
21 lines
615 B
Python
21 lines
615 B
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from .config import Settings
|
|
from .models import ScriptPlan
|
|
|
|
|
|
class ScriptWriter:
|
|
"""Persist generated scripts to disk."""
|
|
|
|
def __init__(self, settings: Settings):
|
|
self.settings = settings
|
|
|
|
def write(self, plan: ScriptPlan, script_body: str) -> Path:
|
|
filename = plan.script_name or self.settings.default_script_name
|
|
destination = self.settings.output_dir / filename
|
|
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
destination.write_text(script_body, encoding="utf-8")
|
|
return destination
|