87 lines
2.1 KiB
Bash
Executable File
87 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Sprint Mode Control
|
|
# Usage:
|
|
# bash sprint-mode.sh start <agents> [duration_hours] [reason]
|
|
# bash sprint-mode.sh stop
|
|
# bash sprint-mode.sh status
|
|
set -euo pipefail
|
|
|
|
SPRINT_FILE="/home/papa/atomizer/dashboard/sprint-mode.json"
|
|
ACTION="${1:?Usage: sprint-mode.sh start|stop|status}"
|
|
|
|
case "$ACTION" in
|
|
start)
|
|
AGENTS="${2:?Specify agents: e.g. 'tech-lead,webster,auditor'}"
|
|
DURATION="${3:-2}" # hours, default 2
|
|
REASON="${4:-Sprint activated}"
|
|
|
|
python3 -c "
|
|
import json
|
|
from datetime import datetime, timedelta, timezone
|
|
|
|
agents = '$AGENTS'.split(',')
|
|
duration_h = float('$DURATION')
|
|
now = datetime.now(timezone.utc)
|
|
expires = now + timedelta(hours=duration_h)
|
|
|
|
data = {
|
|
'active': True,
|
|
'agents': [a.strip() for a in agents],
|
|
'frequency_minutes': 5,
|
|
'started_at': now.isoformat(),
|
|
'expires_at': expires.isoformat(),
|
|
'reason': '$REASON'
|
|
}
|
|
|
|
with open('$SPRINT_FILE', 'w') as f:
|
|
json.dump(data, f, indent=2)
|
|
|
|
print(f'🏃 Sprint started: {len(agents)} agents, expires {expires.strftime(\"%H:%M UTC\")}')
|
|
for a in agents:
|
|
print(f' - {a}')
|
|
"
|
|
;;
|
|
stop)
|
|
python3 -c "
|
|
import json
|
|
data = {
|
|
'active': False,
|
|
'agents': [],
|
|
'frequency_minutes': 5,
|
|
'started_at': None,
|
|
'expires_at': None,
|
|
'reason': None
|
|
}
|
|
with open('$SPRINT_FILE', 'w') as f:
|
|
json.dump(data, f, indent=2)
|
|
print('⏹️ Sprint stopped')
|
|
"
|
|
;;
|
|
status)
|
|
python3 -c "
|
|
import json
|
|
from datetime import datetime, timezone
|
|
|
|
with open('$SPRINT_FILE') as f:
|
|
data = json.load(f)
|
|
|
|
if not data.get('active'):
|
|
print('No active sprint')
|
|
else:
|
|
agents = ', '.join(data.get('agents', []))
|
|
expires = data.get('expires_at', 'unknown')
|
|
reason = data.get('reason', '')
|
|
now = datetime.now(timezone.utc)
|
|
exp = datetime.fromisoformat(expires)
|
|
remaining = max(0, (exp - now).total_seconds() / 60)
|
|
print(f'🏃 Sprint active: {agents}')
|
|
print(f' Reason: {reason}')
|
|
print(f' Remaining: {remaining:.0f} minutes')
|
|
"
|
|
;;
|
|
*)
|
|
echo "Usage: sprint-mode.sh start|stop|status"
|
|
exit 1
|
|
;;
|
|
esac
|