This commit is contained in:
Dmitry 2025-11-21 14:50:00 +03:00
parent b1e54229e7
commit 5fbfda561f
5 changed files with 25 additions and 13 deletions

View file

@ -1,13 +1,6 @@
name: AI Agent - Test & Deploy name: AI Agent - Test & Deploy
on: on:
push:
branches:
- master
paths:
- 'mnemo_cards_web_v2/**'
- 'mnemo_cards_backend/**'
- 'mnemo_cards_common/**'
workflow_dispatch: workflow_dispatch:
inputs: inputs:
component: component:

View file

@ -710,7 +710,7 @@ This PR contains changes for task {task.id} completed by AI Agent.
print(f"❌ Failed to create PR: {e}") print(f"❌ Failed to create PR: {e}")
return False return False
git def _create_branch_and_pr(self, task: Task) -> bool: def _create_branch_and_pr(self, task: Task) -> bool:
"""Create a feature branch and PR for the task.""" """Create a feature branch and PR for the task."""
# Get current task if not provided # Get current task if not provided
if not task: if not task:

View file

@ -77,7 +77,7 @@ class AgentConfig:
max_retries=int(os.getenv("MAX_RETRIES", "3")), max_retries=int(os.getenv("MAX_RETRIES", "3")),
timeout_hours=int(os.getenv("TIMEOUT_HOURS", "6")), timeout_hours=int(os.getenv("TIMEOUT_HOURS", "6")),
cursor_api_key=os.getenv("CURSOR_API_KEY"), cursor_api_key=os.getenv("CURSOR_API_KEY"),
cursor_model=os.getenv("CURSOR_MODEL", "claude-3-5-sonnet-20241022"), cursor_model=os.getenv("CURSOR_MODEL", "auto"),
forgejo_token=os.getenv("FORGEJO_TOKEN"), forgejo_token=os.getenv("FORGEJO_TOKEN"),
forgejo_api_url=os.getenv("FORGEJO_API_URL") or os.getenv("GITHUB_API_URL"), forgejo_api_url=os.getenv("FORGEJO_API_URL") or os.getenv("GITHUB_API_URL"),
commit_mode=os.getenv("COMMIT_MODE", "master"), commit_mode=os.getenv("COMMIT_MODE", "master"),

View file

@ -39,7 +39,7 @@ class CursorCLI:
def __init__(self, def __init__(self,
project_root: Path, project_root: Path,
api_key: str, api_key: str,
model: str = "claude-3-5-sonnet-20241022", model: str = "auto",
verbose: bool = True): verbose: bool = True):
self.project_root = project_root self.project_root = project_root
self.api_key = api_key self.api_key = api_key
@ -123,13 +123,32 @@ class CursorCLI:
# Add bash paths if they exist # Add bash paths if they exist
additional_paths = ":".join([p for p in bash_paths if os.path.exists(p)]) additional_paths = ":".join([p for p in bash_paths if os.path.exists(p)])
new_path = ":".join([additional_paths, current_path]) if additional_paths else current_path new_path = ":".join([additional_paths, current_path]) if additional_paths else current_path
# Prepare environment variables
env = { env = {
"CURSOR_API_KEY": self.api_key, "CURSOR_API_KEY": self.api_key,
"CURSOR_MODEL": self.model,
"PATH": new_path, "PATH": new_path,
} }
# Prepare command
cmd = [self.cursor_agent_path]
# Add model flag if provided
if self.model:
cmd.extend(["--model", self.model])
# Add prompt
cmd.append(task_description)
# Add options
cmd.extend(["--output-format", "stream-json"])
cmd.append("--stream-partial-output")
if force:
cmd.append("--force")
# Add print mode (non-interactive)
cmd.append("-p")
if self.verbose: if self.verbose:
print(f"🚀 Running cursor-agent in {self.project_root}") print(f"🚀 Running cursor-agent in {self.project_root}")
print(f"📝 Task: {task_description[:100]}...") print(f"📝 Task: {task_description[:100]}...")

View file

@ -12,7 +12,7 @@ def main():
"""Main entry point.""" """Main entry point."""
parser = argparse.ArgumentParser(description="Update documentation for a component") parser = argparse.ArgumentParser(description="Update documentation for a component")
parser.add_argument("component", choices=["web_v2", "backend", "common"], help="Component to document") parser.add_argument("component", choices=["web_v2", "backend", "common"], help="Component to document")
parser.add_argument("--model", default="claude-3-5-sonnet-20241022", help="LLM model to use") parser.add_argument("--model", default="auto", help="LLM model to use")
args = parser.parse_args() args = parser.parse_args()