This commit is contained in:
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import os
|
||||
import pwd
|
||||
import shutil
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
@@ -18,6 +19,13 @@ class AiderAgent:
|
||||
task_file.chmod(0o600)
|
||||
command = self.command(task_file)
|
||||
coder = pwd.getpwnam("coder")
|
||||
git_config = Path(coder.pw_dir) / ".gitconfig"
|
||||
git_config.write_text(
|
||||
"[user]\n\tname = LAI Automation Coder\n\temail = coder@localhost\n"
|
||||
f"[safe]\n\tdirectory = {workspace.resolve()}\n"
|
||||
)
|
||||
git_config.chmod(0o600)
|
||||
os.chown(git_config, coder.pw_uid, coder.pw_gid)
|
||||
os.chown(task_file, coder.pw_uid, coder.pw_gid)
|
||||
for path in workspace.rglob("*"):
|
||||
if ".git" not in path.parts:
|
||||
@@ -49,6 +57,9 @@ class AiderAgent:
|
||||
timeout=900,
|
||||
)
|
||||
finally:
|
||||
shutil.rmtree(workspace / ".aider.tags.cache.v4", ignore_errors=True)
|
||||
for artifact in (".aider.chat.history.md", ".aider.input.history"):
|
||||
(workspace / artifact).unlink(missing_ok=True)
|
||||
os.chown(workspace, 0, coder.pw_gid, follow_symlinks=False)
|
||||
workspace.chmod(0o775)
|
||||
if result.returncode != 0:
|
||||
@@ -72,4 +83,8 @@ class AiderAgent:
|
||||
"--input-history-file",
|
||||
"/dev/null",
|
||||
"--no-analytics",
|
||||
"--edit-format",
|
||||
"diff",
|
||||
"--timeout",
|
||||
"60",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user