Skill: ckchzh/email-marketer (version 2.0.0)

--- version: "2.0.0" name: email-marketer description: "Plan email campaigns with segmentation, A/B testing, and benchmarking. Use when designing campaigns, segmenting lists, benchmarking rates." --- # Email Marketer AI toolkit for email marketing operations — configure, benchmark, compare, prompt, evaluate, fine-tune, analyze, cost, usage, optimize, test, and report. All entries are logged locally with timestamps for tracking and audit. ## Commands | Command | Description | |---------|-------------| | `email-marketer configure <input>` | Configure email marketing settings or record a config entry | | `email-marketer benchmark <input>` | Run benchmarks or record a benchmark entry | | `email-marketer compare <input>` | Compare campaigns or record a comparison entry | | `email-marketer prompt <input>` | Generate or record email prompts | | `email-marketer evaluate <input>` | Evaluate campaign performance or record an evaluation entry | | `email-marketer fine-tune <input>` | Fine-tune parameters or record a fine-tuning entry | | `email-marketer analyze <input>` | Analyze campaign data or record an analysis entry | | `email-marketer cost <input>` | Track costs or record a cost entry | | `email-marketer usage <input>` | Track usage metrics or record a usage entry | | `email-marketer optimize <input>` | Optimize campaigns or record an optimization entry | | `email-marketer test <input>` | Run A/B tests or record a test entry | | `email-marketer report <input>` | Generate reports or record a report entry | | `email-marketer stats` | Show summary statistics across all entry types | | `email-marketer export <fmt>` | Export all data (json, csv, or txt) | | `email-marketer search <term>` | Search across all log entries by keyword | | `email-marketer recent` | Show the 20 most recent activity entries | | `email-marketer status` | Health check — version, data dir, entry count, disk usage | | `email-marketer help` | Show help with all available commands | | `email-marketer version` | Show current version (v2.0.0) | Each command (configure, benchmark, compare, prompt, evaluate, fine-tune, analyze, cost, usage, optimize, test, report) works in two modes: - **No arguments**: displays the 20 most recent entries from that command's log - **With arguments**: records the input with a timestamp and appends to the command's log file ## Data Storage All data is stored locally at `~/.local/share/email-marketer/`. Each action is logged to its own file (e.g., `configure.log`, `benchmark.log`, `analyze.log`). A unified `history.log` tracks all operations. The built-in export function supports JSON, CSV, and plain text formats. ## Requirements - bash 4+ (uses `set -euo pipefail`) - Standard Unix utilities (`wc`, `du`, `grep`, `tail`, `sed`, `date`) ## When to Use - Tracking email campaign configurations and benchmark results - Logging A/B test outcomes and evaluation metrics - Recording cost and usage data for email marketing operations - Fine-tuning campaign parameters with documented history - Analyzing campaign performance trends over time - Exporting marketing data for stakeholder reports ## Examples ```bash # Configure a new campaign email-marketer configure "weekly newsletter — segment: active users, send: Tuesday 9AM" # Record a benchmark result email-marketer benchmark "open rate 24.5%, click rate 3.2%, industry avg 21%" # Compare two campaigns email-marketer compare "Campaign A: 28% open vs Campaign B: 22% open" # Evaluate campaign performance email-marketer evaluate "Q1 drip sequence — 15% conversion, 2.1% unsubscribe" # Record a cost entry email-marketer cost "March send volume: 50K emails, cost: $45" # Run an A/B test email-marketer test "Subject line A vs B — A won with 31% open rate" # View recent activity email-marketer recent # Export all data as CSV email-marketer export csv # Search for entries about "onboarding" email-marketer search onboarding # Check overall health email-marketer status ``` --- Powered by BytesAgain | bytesagain.com | [REDACTED_SECRET]

path: scripts/script.sh
content: #!/usr/bin/env bash
# Email Marketer — ai tool
# Powered by BytesAgain | bytesagain.com | [REDACTED_SECRET]
set -euo pipefail

DATA_DIR="${HOME}/.local/share/email-marketer"
mkdir -p "$DATA_DIR"

_log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; }
_version() { echo "email-marketer v2.0.0"; }

_help() {
    echo "Email Marketer v2.0.0 — ai toolkit"
    echo ""
    echo "Usage: email-marketer <command> [args]"
    echo ""
    echo "Commands:"
    echo "  configure          Configure"
    echo "  benchmark          Benchmark"
    echo "  compare            Compare"
    echo "  prompt             Prompt"
    echo "  evaluate           Evaluate"
    echo "  fine-tune          Fine Tune"
    echo "  analyze            Analyze"
    echo "  cost               Cost"
    echo "  usage              Usage"
    echo "  optimize           Optimize"
    echo "  test               Test"
    echo "  report             Report"
    echo "  stats              Summary statistics"
    echo "  export <fmt>       Export (json|csv|txt)"
    echo "  search <term>      Search entries"
    echo "  recent             Recent activity"
    echo "  status             Health check"
    echo "  help               Show this help"
    echo "  version            Show version"
    echo ""
    echo "Data: $DATA_DIR"
}

_stats() {
    echo "=== Email Marketer Stats ==="
    local total=0
    for f in "$DATA_DIR"/*.log; do
        [ -f "$f" ] || continue
        local name=$(basename "$f" .log)
        local c=$(wc -l < "$f")
        total=$((total + c))
        echo "  $name: $c entries"
    done
    echo "  ---"
    echo "  Total: $total entries"
    echo "  Data size: $(du -sh "$DATA_DIR" 2>/dev/null | cut -f1)"
}

_export() {
    local fmt="${1:-json}"
    local out="$DATA_DIR/export.$fmt"
    case "$fmt" in
        json)
            echo "[" > "$out"
            local first=1
            for f in "$DATA_DIR"/*.log; do
                [ -f "$f" ] || continue
                local name=$(basename "$f" .log)
                while IFS='|' read -r ts val; do
                    [ $first -eq 1 ] && first=0 || echo "," >> "$out"
                    printf '  {"type":"%s","time":"%s","value":"%s"}' "$name" "$ts" "$val" >> "$out"
                done < "$f"
            done
            echo "\n]" >> "$out"
            ;;
        csv)
            echo "type,time,value" > "$out"
            for f in "$DATA_DIR"/*.log; do
                [ -f "$f" ] || continue
                local name=$(basename "$f" .log)
                while IFS='|' read -r ts val; do echo "$name,$ts,$val" >> "$out"; done < "$f"
            done
            ;;
        txt)
            echo "=== Email Marketer Export ===" > "$out"
            for f in "$DATA_DIR"/*.log; do
                [ -f "$f" ] || continue
                echo "--- $(basename "$f" .log) ---" >> "$out"
                cat "$f" >> "$out"
            done
            ;;
        *) echo "Formats: json, csv, txt"; return 1 ;;
    esac
    echo "Exported to $out ($(wc -c < "$out") bytes)"
}

_status() {
    echo "=== Email Marketer Status ==="
    echo "  Version: v2.0.0"
    echo "  Data dir: $DATA_DIR"
    echo "  Entries: $(cat "$DATA_DIR"/*.log 2>/dev/null | wc -l) total"
    echo "  Disk: $(du -sh "$DATA_DIR" 2>/dev/null | cut -f1)"
    echo "  Last: $(tail -1 "$DATA_DIR/history.log" 2>/dev/null || echo never)"
    echo "  Status: OK"
}

_search() {
    local term="${1:?Usage: email-marketer search <term>}"
    echo "Searching for: $term"
    for f in "$DATA_DIR"/*.log; do
        [ -f "$f" ] || continue
        local m=$(grep -i "$term" "$f" 2>/dev/null || true)
        if [ -n "$m" ]; then
            echo "  --- $(basename "$f" .log) ---"
            echo "$m" | sed 's/^/    /'
        fi
    done
}

_recent() {
    echo "=== Recent Activity ==="
    tail -20 "$DATA_DIR/history.log" 2>/dev/null | sed 's/^/  /' || echo "  No activity yet."
}

case "${1:-help}" in
    configure)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent configure entries:"
            tail -20 "$DATA_DIR/configure.log" 2>/dev/null || echo "  No entries yet. Use: email-marketer configure <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/configure.log"
            local total=$(wc -l < "$DATA_DIR/configure.log")
            echo "  [Email Marketer] configure: $input"
            echo "  Saved. Total configure entries: $total"
            _log "configure" "$input"
        fi
        ;;
    benchmark)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent benchmark entries:"
            tail -20 "$DATA_DIR/benchmark.log" 2>/dev/null || echo "  No entries yet. Use: email-marketer benchmark <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/benchmark.log"
            local total=$(wc -l < "$DATA_DIR/benchmark.log")
            echo "  [Email Marketer] benchmark: $input"
            echo "  Saved. Total benchmark entries: $total"
            _log "benchmark" "$input"
        fi
        ;;
    compare)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent compare entries:"
            tail -20 "$DATA_DIR/compare.log" 2>/dev/null || echo "  No entries yet. Use: email-marketer compare <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/compare.log"
            local total=$(wc -l < "$DATA_DIR/compare.log")
            echo "  [Email Marketer] compare: $input"
            echo "  Saved. Total compare entries: $total"
            _log "compare" "$input"
        fi
        ;;
    prompt)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent prompt entries:"
            tail -20 "$DATA_DIR/prompt.log" 2>/dev/null || echo "  No entries yet. Use: email-marketer prompt <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/prompt.log"
            local total=$(wc -l < "$DATA_DIR/prompt.log")
            echo "  [Email Marketer] prompt: $input"
            echo "  Saved. Total prompt entries: $total"
            _log "prompt" "$input"
        fi
        ;;
    evaluate)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent evaluate entries:"
            tail -20 "$DATA_DIR/evaluate.log" 2>/dev/null || echo "  No entries yet. Use: email-marketer evaluate <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/evaluate.log"
            local total=$(wc -l < "$DATA_DIR/evaluate.log")
            echo "  [Email Marketer] evaluate: $input"
            echo "  Saved. Total evaluate entries: $total"
            _log "evaluate" "$input"
        fi
        ;;
    fine-tune)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent fine-tune entries:"
            tail -20 "$DATA_DIR/fine-tune.log" 2>/dev/null || echo "  No entries yet. Use: email-marketer fine-tune <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/fine-tune.log"
            local total=$(wc -l < "$DATA_DIR/fine-tune.log")
            echo "  [Email Marketer] fine-tune: $input"
            echo "  Saved. Total fine-tune entries: $total"
            _log "fine-tune" "$input"
        fi
        ;;
    analyze)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent analyze entries:"
            tail -20 "$DATA_DIR/analyze.log" 2>/dev/null || echo "  No entries yet. Use: email-marketer analyze <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/analyze.log"
            local total=$(wc -l < "$DATA_DIR/analyze.log")
            echo "  [Email Marketer] analyze: $input"
            echo "  Saved. Total analyze entries: $total"
            _log "analyze" "$input"
        fi
        ;;
    cost)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent cost entries:"
            tail -20 "$DATA_DIR/cost.log" 2>/dev/null || echo "  No entries yet. Use: email-marketer cost <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/cost.log"
            local total=$(wc -l < "$DATA_DIR/cost.log")
            echo "  [Email Marketer] cost: $input"
            echo "  Saved. Total cost entries: $total"
            _log "cost" "$input"
        fi
        ;;
    usage)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent usage entries:"
            tail -20 "$DATA_DIR/usage.log" 2>/dev/null || echo "  No entries yet. Use: email-marketer usage <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/usage.log"
            local total=$(wc -l < "$DATA_DIR/usage.log")
            echo "  [Email Marketer] usage: $input"
            echo "  Saved. Total usage entries: $total"
            _log "usage" "$input"
        fi
        ;;
    optimize)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent optimize entries:"
            tail -20 "$DATA_DIR/optimize.log" 2>/dev/null || echo "  No entries yet. Use: email-marketer optimize <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/optimize.log"
            local total=$(wc -l < "$DATA_DIR/optimize.log")
            echo "  [Email Marketer] optimize: $input"
            echo "  Saved. Total optimize entries: $total"
            _log "optimize" "$input"
        fi
        ;;
    test)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent test entries:"
            tail -20 "$DATA_DIR/test.log" 2>/dev/null || echo "  No entries yet. Use: email-marketer test <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/test.log"
            local total=$(wc -l < "$DATA_DIR/test.log")
            echo "  [Email Marketer] test: $input"
            echo "  Saved. Total test entries: $total"
            _log "test" "$input"
        fi
        ;;
    report)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent report entries:"
            tail -20 "$DATA_DIR/report.log" 2>/dev/null || echo "  No entries yet. Use: email-marketer report <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/report.log"
            local total=$(wc -l < "$DATA_DIR/report.log")
            echo "  [Email Marketer] report: $input"
            echo "  Saved. Total report entries: $total"
            _log "report" "$input"
        fi
        ;;
    stats) _stats ;;
    export) shift; _export "$@" ;;
    search) shift; _search "$@" ;;
    recent) _recent ;;
    status) _status ;;
    help|--help|-h) _help ;;
    version|--version|-v) _version ;;
    *)
        echo "Unknown: $1 — run 'email-marketer help'"
        exit 1
        ;;
esac

Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (MEDIUM)