File size: 738 Bytes
6369972
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""
PROMPT> python -m src.plan.plan_file
"""
from datetime import datetime
from dataclasses import dataclass

@dataclass
class PlanFile:
    content: str

    @classmethod
    def create(cls, vague_plan_description: str) -> "PlanFile":
        run_date = datetime.now()
        pretty_date = run_date.strftime("%Y-%b-%d")
        plan_prompt = (
            f"Plan:\n{vague_plan_description}\n\n"
            f"Today's date:\n{pretty_date}\n\n"
            "Project start ASAP"
        )
        return cls(plan_prompt)

    def save(self, file_path: str) -> None:
        with open(file_path, "w") as f:
            f.write(self.content)

if __name__ == "__main__":
    plan = PlanFile.create("My plan is here!")
    print(plan.content)