Commit d5ebbb96 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Remove all unnecessary files

parent 940f5832
Loading
Loading
Loading
Loading

.gitignore

deleted100644 → 0
+0 −95
Original line number Diff line number Diff line
# Dependencies
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
mermaid-filter.err 

# Build outputs
dist/
dist-ssr/
build/
out/
*.local

# Environment files
.env
.env.local
.env.*.local
.env.development
.env.test
.env.production

# IDE files
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
.idea/
*.swp
*.swo
*~

# macOS
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Testing
coverage/
.nyc_output/
*.lcov
.cache/

# TypeScript
*.tsbuildinfo
.tsc-cache/

# Package managers
.npm
.yarn/
.pnp.*

# Misc
*.pid
*.seed
*.pid.lock
.eslintcache
.stylelintcache
*.tgz

# Temporary files
*.tmp
*.temp
*.bak

# claude etc.
.claude/

# Lock files (uncomment if you don't want to commit them)
# package-lock.json
# yarn.lock
# pnpm-lock.yaml
 No newline at end of file

OLD_Spec-template.docx

deleted100644 → 0
−579 KiB

File deleted.

Spec-template.docx

deleted100644 → 0
−623 KiB

File deleted.

add-line-numbers.lua

deleted100644 → 0
+0 −37
Original line number Diff line number Diff line
-- Lua filter to add line numbers to PDF output
-- This filter adds lineno package commands to enable line numbering

function Meta(meta)
  -- Check if we should add line numbers
  if true then
    -- Add to header-includes
    if not meta['header-includes'] then
      meta['header-includes'] = pandoc.MetaList({})
    end
    
    local header = meta['header-includes']
    header[#header + 1] = pandoc.MetaInlines({
      pandoc.RawInline('latex', '\\usepackage{lineno}\n\\modulolinenumbers[5]\n\\linenumbers')
    })
    
    return meta
  end
end

-- Track when we hit the arabic numbering section
local arabicStarted = false

function RawBlock(el)
  if el.format == "latex" or el.format == "tex" then
    -- Check if this is the arabic page numbering command
    if el.text:match("\\pagenumbering{arabic}") then
      arabicStarted = true
      -- Add line numbers after arabic numbering
      return {
        el,
        pandoc.RawBlock('latex', '\\linenumbers')
      }
    end
  end
  return el
end
 No newline at end of file

after-meeting.sh

deleted100755 → 0
+0 −298
Original line number Diff line number Diff line
#!/bin/bash
#
# after-meeting.sh
#
# Script to process a markdown file after a meeting:
# 1. Convert to DOCX and PDF
# 2. Upload DOCX to a website via instrumented browser
# 3. Send email notification
#
# Usage: ./after-meeting.sh <source-markdown-file>
#

# Configuration
UPLOAD_URL="${UPLOAD_URL:-https://example.com/upload}"
EMAIL_RECIPIENT="${EMAIL_RECIPIENT:-recipient@example.com}"
EMAIL_SUBJECT="${EMAIL_SUBJECT:-Meeting Document Upload Notification}"
BROWSER_TIMEOUT="${BROWSER_TIMEOUT:-30}"

# Check if source file is provided
if [ $# -eq 0 ]; then
    echo "Usage: $0 <source-markdown-file>"
    echo ""
    echo "Environment variables:"
    echo "  UPLOAD_URL      - URL for document upload (default: https://example.com/upload)"
    echo "  EMAIL_RECIPIENT - Email recipient (default: recipient@example.com)"
    echo "  EMAIL_SUBJECT   - Email subject (default: Meeting Document Upload Notification)"
    echo "  BROWSER_TIMEOUT - Browser timeout in seconds (default: 30)"
    exit 1
fi

SOURCE_FILE="$1"

# Validate source file exists
if [ ! -f "$SOURCE_FILE" ]; then
    echo "ERROR: Source file '$SOURCE_FILE' not found."
    exit 1
fi

# Extract base name for output files
BASE_NAME=$(basename "$SOURCE_FILE" .md)
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
OUTPUT_DIR="output_${TIMESTAMP}"

echo "========================================="
echo "After Meeting Document Processor"
echo "========================================="
echo "Source: $SOURCE_FILE"
echo "Output directory: $OUTPUT_DIR"
echo "Upload URL: $UPLOAD_URL"
echo "Email recipient: $EMAIL_RECIPIENT"
echo "========================================="

# Create output directory
mkdir -p "$OUTPUT_DIR"

# Step 1: Convert markdown to DOCX and PDF
echo -e "\n------ Converting to DOCX and PDF --------"

# Generate DOCX
echo "Generating DOCX..."
./publish_spec_local.sh --source "$SOURCE_FILE" --format docx --output "$OUTPUT_DIR" --tag "meeting_${TIMESTAMP}"

if [ $? -ne 0 ]; then
    echo "ERROR: Failed to generate DOCX"
    exit 1
fi

# Generate PDF
echo "Generating PDF..."
./publish_spec_local.sh --source "$SOURCE_FILE" --format pdf --output "$OUTPUT_DIR" --tag "meeting_${TIMESTAMP}"

if [ $? -ne 0 ]; then
    echo "ERROR: Failed to generate PDF"
    exit 1
fi

# Find generated files
DOCX_FILE=$(find "$OUTPUT_DIR" -name "*.docx" -type f | head -1)
PDF_FILE=$(find "$OUTPUT_DIR" -name "*.pdf" -type f | head -1)

if [ -z "$DOCX_FILE" ]; then
    echo "ERROR: No DOCX file generated"
    exit 1
fi

if [ -z "$PDF_FILE" ]; then
    echo "ERROR: No PDF file generated"
    exit 1
fi

echo "✓ Generated DOCX: $DOCX_FILE"
echo "✓ Generated PDF: $PDF_FILE"

# Step 2: Upload DOCX via instrumented browser
echo -e "\n------ Uploading DOCX to website --------"

# Check if playwright is installed
if ! command -v playwright >/dev/null 2>&1 && ! command -v npx >/dev/null 2>&1; then
    echo "ERROR: Playwright is required for browser automation"
    echo "Install with: npm install -g playwright"
    echo "Then install browsers: playwright install chromium"
    exit 1
fi

# Create upload script
cat > "$OUTPUT_DIR/upload_script.js" << 'EOF'
const { chromium } = require('playwright');
const path = require('path');

(async () => {
    const docxFile = process.argv[2];
    const uploadUrl = process.argv[3];
    const timeout = parseInt(process.argv[4] || '30') * 1000;
    
    if (!docxFile || !uploadUrl) {
        console.error('Usage: node upload_script.js <docx-file> <upload-url> [timeout-seconds]');
        process.exit(1);
    }
    
    const browser = await chromium.launch({ 
        headless: false, // Set to true for background operation
        timeout: timeout 
    });
    
    try {
        const page = await browser.newPage();
        
        // Navigate to upload page
        console.log(`Navigating to ${uploadUrl}...`);
        await page.goto(uploadUrl, { waitUntil: 'networkidle' });
        
        // Wait for file input
        // Adjust the selector based on your upload page
        const fileInput = await page.waitForSelector('input[type="file"]', { timeout: 10000 });
        
        // Upload the file
        console.log(`Uploading ${path.basename(docxFile)}...`);
        await fileInput.setInputFiles(docxFile);
        
        // Wait for upload button and click
        // Adjust the selector based on your upload page
        const uploadButton = await page.waitForSelector('button[type="submit"], input[type="submit"], button:has-text("Upload")', { timeout: 5000 });
        await uploadButton.click();
        
        // Wait for success indicator
        // Adjust based on your upload page's success message
        await page.waitForSelector('.success-message, .alert-success, :has-text("successfully")', { timeout: timeout });
        
        console.log('Upload completed successfully!');
        
        // Take screenshot for verification
        await page.screenshot({ path: path.join(path.dirname(docxFile), 'upload_confirmation.png') });
        
    } catch (error) {
        console.error('Upload failed:', error.message);
        process.exit(1);
    } finally {
        await browser.close();
    }
})();
EOF

# Run the upload script
if command -v playwright >/dev/null 2>&1; then
    PLAYWRIGHT_CMD="playwright"
elif command -v npx >/dev/null 2>&1; then
    PLAYWRIGHT_CMD="npx playwright"
else
    echo "WARNING: Playwright not found. Skipping browser upload."
    echo "To enable upload, install with: npm install -g playwright"
    UPLOAD_STATUS="skipped"
fi

if [ -n "$PLAYWRIGHT_CMD" ]; then
    echo "Launching browser for upload..."
    node "$OUTPUT_DIR/upload_script.js" "$DOCX_FILE" "$UPLOAD_URL" "$BROWSER_TIMEOUT"
    
    if [ $? -eq 0 ]; then
        echo "✓ Upload completed successfully"
        UPLOAD_STATUS="success"
    else
        echo "⚠ Upload failed"
        UPLOAD_STATUS="failed"
    fi
fi

# Step 3: Send email notification
echo -e "\n------ Sending email notification --------"

# Check for email command
if command -v mail >/dev/null 2>&1; then
    MAIL_CMD="mail"
elif command -v sendmail >/dev/null 2>&1; then
    MAIL_CMD="sendmail"
elif command -v mutt >/dev/null 2>&1; then
    MAIL_CMD="mutt"
else
    echo "WARNING: No email client found (mail, sendmail, or mutt)"
    echo "Cannot send email notification"
    MAIL_CMD=""
fi

if [ -n "$MAIL_CMD" ]; then
    # Prepare email body
    EMAIL_BODY="Meeting document processing completed.

Source file: $SOURCE_FILE
Generated files:
- DOCX: $(basename "$DOCX_FILE")
- PDF: $(basename "$PDF_FILE")

Upload status: $UPLOAD_STATUS
Upload URL: $UPLOAD_URL

Timestamp: $(date)
"

    # Send email based on available command
    case "$MAIL_CMD" in
        mail)
            echo "$EMAIL_BODY" | mail -s "$EMAIL_SUBJECT" "$EMAIL_RECIPIENT"
            ;;
        mutt)
            echo "$EMAIL_BODY" | mutt -s "$EMAIL_SUBJECT" -- "$EMAIL_RECIPIENT"
            ;;
        sendmail)
            {
                echo "To: $EMAIL_RECIPIENT"
                echo "Subject: $EMAIL_SUBJECT"
                echo ""
                echo "$EMAIL_BODY"
            } | sendmail "$EMAIL_RECIPIENT"
            ;;
    esac
    
    if [ $? -eq 0 ]; then
        echo "✓ Email sent to $EMAIL_RECIPIENT"
    else
        echo "⚠ Failed to send email"
    fi
else
    # Alternative: Use Python if available
    if command -v python3 >/dev/null 2>&1; then
        echo "Attempting to send email using Python..."
        python3 << EOF
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import os

# Email configuration from environment
smtp_server = os.getenv('SMTP_SERVER', 'localhost')
smtp_port = int(os.getenv('SMTP_PORT', '587'))
smtp_user = os.getenv('SMTP_USER', '')
smtp_pass = os.getenv('SMTP_PASS', '')
from_email = os.getenv('FROM_EMAIL', 'noreply@example.com')

try:
    msg = MIMEMultipart()
    msg['From'] = from_email
    msg['To'] = '$EMAIL_RECIPIENT'
    msg['Subject'] = '$EMAIL_SUBJECT'
    
    body = '''$EMAIL_BODY'''
    msg.attach(MIMEText(body, 'plain'))
    
    if smtp_user and smtp_pass:
        server = smtplib.SMTP(smtp_server, smtp_port)
        server.starttls()
        server.login(smtp_user, smtp_pass)
    else:
        server = smtplib.SMTP(smtp_server, smtp_port)
    
    server.send_message(msg)
    server.quit()
    print("✓ Email sent via Python SMTP")
except Exception as e:
    print(f"⚠ Failed to send email via Python: {e}")
EOF
    fi
fi

echo -e "\n========================================="
echo "After meeting processing complete!"
echo "Output directory: $OUTPUT_DIR"
echo ""
echo "Generated files:"
echo "  • DOCX: $(basename "$DOCX_FILE")"
echo "  • PDF: $(basename "$PDF_FILE")"
if [ -f "$OUTPUT_DIR/upload_confirmation.png" ]; then
    echo "  • Upload screenshot: upload_confirmation.png"
fi
echo ""
echo "Upload status: $UPLOAD_STATUS"
echo "Email status: Sent to $EMAIL_RECIPIENT"
echo "========================================="

exit 0
 No newline at end of file
Loading