Dump the spec to the specified output directory. Args: output_dir (str): The directory to dump the spec files. Returns: str: The path to the dumped spec directory.
(self, output_dir: str)
| 29 | self.implementation = DEFAULT_IMPLEMENTATION |
| 30 | |
| 31 | def dump(self, output_dir: str) -> str: |
| 32 | """ |
| 33 | Dump the spec to the specified output directory. |
| 34 | |
| 35 | Args: |
| 36 | output_dir (str): The directory to dump the spec files. |
| 37 | |
| 38 | Returns: |
| 39 | str: The path to the dumped spec directory. |
| 40 | """ |
| 41 | output_path: str = os.path.join(output_dir, '.spec') |
| 42 | os.makedirs(output_path, exist_ok=True) |
| 43 | |
| 44 | with open( |
| 45 | os.path.join(output_path, 'plan.md'), 'w', |
| 46 | encoding='utf-8') as f: |
| 47 | f.write(self.plan) |
| 48 | |
| 49 | with open( |
| 50 | os.path.join(output_path, 'tasks.md'), 'w', |
| 51 | encoding='utf-8') as f: |
| 52 | f.write(self.tasks) |
| 53 | |
| 54 | with open( |
| 55 | os.path.join(output_path, 'implementation.md'), |
| 56 | 'w', |
| 57 | encoding='utf-8') as f: |
| 58 | f.write(self.implementation) |
| 59 | |
| 60 | return output_path |
| 61 | |
| 62 | |
| 63 | if __name__ == '__main__': |