-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·124 lines (118 loc) · 3.42 KB
/
run.sh
File metadata and controls
executable file
·124 lines (118 loc) · 3.42 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
# Load .env file
if [ -f ".env" ]; then
set -a
source .env
set +a
fi
# Activate virtual environment
if [ ! -d ".venv" ]; then
echo "Creating virtual environment..."
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
else
source .venv/bin/activate
fi
TASKS_FILE="${TASKS_FILE:-tasks/getting-started.md}"
usage() {
echo ""
echo " Agent Factory — autonomous coding agent"
echo ""
echo " Usage: ./run.sh <command> [options]"
echo ""
echo " Markdown tasks:"
echo " all Run all tasks from the tasks file"
echo " task <N> Run task N (1-indexed)"
echo " dry Dry run all tasks (no changes)"
echo " dry-task <N> Dry run task N only"
echo " list List tasks in the file"
echo ""
echo " External sources:"
echo " jira Fetch and run tasks from Jira (needs JIRA_* in .env)"
echo " notion Fetch and run tasks from Notion (needs NOTION_* in .env)"
echo ""
echo " Autonomous:"
echo " scan Scan repo for improvements and fix them"
echo " watch <jira|notion> Poll for tasks continuously (Ctrl+C to stop)"
echo ""
echo " Utilities:"
echo " logs List recent session logs"
echo ""
echo " Options:"
echo " TASKS_FILE=file.md Use a different tasks file (default: tasks-example.md)"
echo ""
echo " Examples:"
echo " ./run.sh all"
echo " ./run.sh task 1"
echo " ./run.sh dry"
echo " TASKS_FILE=demo-tasks.md ./run.sh task 2"
echo " ./run.sh jira"
echo " ./run.sh notion"
echo " ./run.sh scan"
echo " ./run.sh watch jira"
echo ""
}
case "${1:-help}" in
all)
python -m agent_factory markdown "$TASKS_FILE"
;;
task)
if [ -z "${2:-}" ]; then
echo "Error: specify a task number, e.g. ./run.sh task 1"
exit 1
fi
python -m agent_factory markdown "$TASKS_FILE" --task "$2"
;;
dry)
python -m agent_factory markdown "$TASKS_FILE" --dry-run
;;
dry-task)
if [ -z "${2:-}" ]; then
echo "Error: specify a task number, e.g. ./run.sh dry-task 1"
exit 1
fi
python -m agent_factory markdown "$TASKS_FILE" --task "$2" --dry-run
;;
list)
python3 -c "
from agent_factory.task_parser import load_tasks
tasks = load_tasks('$TASKS_FILE')
print(f'\n {len(tasks)} tasks in $TASKS_FILE:\n')
for i, t in enumerate(tasks, 1):
print(f' {i}. [{t.task_type}] {t.title}')
if t.files:
print(f' files: {chr(44).join(chr(32) + f for f in t.files)}')
print()
"
;;
jira)
python -m agent_factory jira
;;
notion)
python -m agent_factory notion
;;
scan)
python -m agent_factory scan
;;
watch)
if [ -z "${2:-}" ]; then
echo "Error: specify source, e.g. ./run.sh watch jira"
exit 1
fi
python -m agent_factory watch "$2"
;;
logs)
if [ -d "logs" ]; then
ls -lt logs/*.md 2>/dev/null | head -20
else
echo "No logs yet."
fi
;;
help|--help|-h|*)
usage
;;
esac