""" id: docs title: Docs & Changelog author: admin description: Generate changelog and update README snippets. version: 0.1.0 license: Proprietary """ import subprocess import io class Tools: def changelog( self, repo: str = "/data/adaptai/projects/oui-max", max_lines: int = 200 ) -> dict: cmd = f"git -C {repo} log --oneline -n {max_lines}" p = subprocess.run(["bash", "-lc", cmd], capture_output=True, text=True) return {"stdout": p.stdout, "stderr": p.stderr, "exit_code": p.returncode} def update_readme_append(self, repo: str, text: str) -> dict: p = f"{repo}/README.md" with io.open(p, "a", encoding="utf-8") as f: f.write("\n" + text + "\n") return {"ok": True, "path": p}