Files
legal-ai/scripts/notify.py
Chaim 11c73a7c60 CEO: add email notifications, subtask parentId, and Paperclip UI assets
- CEO agent now sends email via notify.py when awaiting human response
- CEO creates child issues (parentId) instead of flat disconnected issues
- Fix notify.py email address to chaim+paperclip@marcus-law.co.il
- Move Paperclip UI assets (RTL CSS + Hebrew JS) into repo under scripts/
- Add deploy.sh script to push assets to live Paperclip instance
- Fix comment box positioning: newest comment on top, input below it

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 15:55:55 +00:00

54 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python3
"""Send email notification from agents via SMTP.
Usage:
python3 scripts/notify.py "subject" "body"
python3 scripts/notify.py "subject" --file /path/to/body.md
"""
import smtplib
import sys
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
SMTP_HOST = "smtp.gmail.com"
SMTP_PORT = 587
FROM_EMAIL = "notify@marcus-law.co.il"
FROM_PASS = "vuva jwed lbuz xjds"
TO_EMAIL = "chaim+paperclip@marcus-law.co.il"
def send(subject: str, body: str) -> bool:
msg = MIMEMultipart("alternative")
msg["Subject"] = subject
msg["From"] = f"עוזר משפטי <{FROM_EMAIL}>"
msg["To"] = TO_EMAIL
msg.attach(MIMEText(body, "plain", "utf-8"))
try:
with smtplib.SMTP(SMTP_HOST, SMTP_PORT) as server:
server.starttls()
server.login(FROM_EMAIL, FROM_PASS)
server.sendmail(FROM_EMAIL, TO_EMAIL, msg.as_string())
return True
except Exception as e:
print(f"Email failed: {e}", file=sys.stderr)
return False
if __name__ == "__main__":
if len(sys.argv) < 3:
print("Usage: notify.py 'subject' 'body' OR notify.py 'subject' --file path")
sys.exit(1)
subject = sys.argv[1]
if sys.argv[2] == "--file":
body = open(sys.argv[3], encoding="utf-8").read()
else:
body = sys.argv[2]
if send(subject, body):
print(f"Sent to {TO_EMAIL}")
else:
sys.exit(1)