| import os | |
| MODULE_DIR = os.path.join(os.path.dirname(__file__), "../modules") | |
| class ModuleWriter: | |
| def __init__(self): | |
| self.dir = MODULE_DIR | |
| def create_module(self, name, content): | |
| filename = os.path.join(self.dir, f"{name}.py") | |
| with open(filename, "w") as f: | |
| f.write(content) | |
| return f"Module {name} created." | |
| def list_modules(self): | |
| return [f for f in os.listdir(self.dir) if f.endswith(".py")] | |