-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
79 lines (66 loc) · 1.97 KB
/
main.py
File metadata and controls
79 lines (66 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import argparse
import sys
import time
import logging
import pyautogui
from src.core.workflow import workflow
def main():
"""Command-line entry point function"""
parser = argparse.ArgumentParser(
description="Automated Cursor Workflow - Self-iteratively control Cursor to complete tasks",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
python main.py --input "I want to build a game of tic tac toe in python."
python main.py -i "Create a web scraper for news articles"
python main.py --input "Build a calculator app" --delay 3
python main.py -i "Build a todo app" -d 3 -r 10
"""
)
parser.add_argument(
'-i', '--input',
type=str,
required=True,
help='User input task description (required)'
)
parser.add_argument(
'-d', '--delay',
type=int,
default=5,
help='Delay time before startup (seconds), default is 5 seconds'
)
parser.add_argument(
'-r', '--max-rounds',
type=int,
default=5,
help='Maximum iteration rounds, default is 5 rounds'
)
args = parser.parse_args()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s',
handlers=[
logging.FileHandler(f'outputs/workflow_{time.time()}.log', encoding='utf-8'),
logging.StreamHandler(sys.stdout)
]
)
logging.info("="*60)
logging.info("Auto-Cursor Workflow Started")
logging.info(f"User Input: {args.input}")
logging.info(f"Startup Delay: {args.delay} seconds")
logging.info(f"Max Rounds: {args.max_rounds} rounds")
logging.info("="*60)
# Startup delay
if args.delay > 0:
logging.info(f"Waiting {args.delay} seconds before starting...")
time.sleep(args.delay)
# Execute workflow
result = workflow(args.input)
logging.info("="*60)
logging.info(f"Workflow Completed: {result}")
logging.info("="*60)
# Move mouse to safe position
pyautogui.moveTo(200, 200)
if __name__ == "__main__":
main()