Real IMAP connection via imapflow library: - Connects to IMAP server (IMAPFlow, TLS on port 993) - Fetches recent messages (configurable limit, default 20) - Extracts: from, fromEmail, subject, date, snippet (200 chars) - Thread-to-contact matching (PRD §6.1): 1. Match sender email against persons table 2. If no person match, extract domain and match against company.website 3. Returns matchedCompany + matchedPerson for each email - Audit-logged (action: crm.mailsync:imap) - Zod validated (host, port, user, password, folder, limit) - 502 on IMAP connection failure with detail - 400 on validation failure Tested: invalid creds → 502 'IMAP connection failed', missing host → 400
33 lines
769 B
Bash
Executable File
33 lines
769 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
OUTPUT_DIR="output/survey_paper"
|
|
mkdir -p "$OUTPUT_DIR"
|
|
|
|
# Copy template files to output
|
|
if [ ! -f "$OUTPUT_DIR/main.tex" ]; then
|
|
cp templates/survey/main.tex "$OUTPUT_DIR/"
|
|
fi
|
|
|
|
# Copy sections and bibliography
|
|
cp -r templates/survey/sections "$OUTPUT_DIR/" 2>/dev/null || true
|
|
cp templates/survey/figures "$OUTPUT_DIR/" 2>/dev/null || true
|
|
|
|
cd "$OUTPUT_DIR"
|
|
|
|
echo "First pdflatex run..."
|
|
pdflatex -interaction=nonstopmode main.tex || true
|
|
|
|
echo "Running bibtex..."
|
|
if [ -f bibliography.bib ]; then
|
|
bibtex main || true
|
|
fi
|
|
|
|
echo "Second pdflatex run..."
|
|
pdflatex -interaction=nonstopmode main.tex || true
|
|
|
|
echo "Final pdflatex run..."
|
|
pdflatex -interaction=nonstopmode main.tex || true
|
|
|
|
echo "Compilation complete. PDF: $OUTPUT_DIR/main.pdf"
|