#!/usr/bin/env bash # make.sh — pdf unified CLI (HTML → PDF) # Usage: bash make.sh [options] # # Commands: # check Verify all dependencies # fix Auto-install missing dependencies # render --in page.html --out report.pdf [--wait 15000] [--format A4] ... # CREATE: render any HTML file/URL → PDF # reformat --input doc.md --out report.pdf [--title T] [--accent #HEX] ... # REFORMAT: parse markdown/text/pdf → HTML → PDF # fill [args...] FILL: probe / inspect / apply (AcroForm) # scan / rasterize / preview / overlay / lint (visual) # # For READ / extract existing PDFs, see docs/read-guide.md (pdfplumber default, # scripts/read_pdf_vision.py for vision escalation). # For PDF mutation (merge / split / rotate / watermark / annotate), see # docs/advanced-reference.md (qpdf / pypdf / reportlab cookbook). # # Exit codes: 0 success, 1 usage error, 2 dep missing, 3 runtime error set -euo pipefail SCRIPTS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SKILL_ROOT="$(cd "$SCRIPTS/.." && pwd)" PY="${PYTHON:-$(command -v python3 2>/dev/null || command -v python 2>/dev/null || echo python3)}" # ── Colour helpers ───────────────────────────────────────────────────────────── red() { printf '\033[0;31m%s\033[0m\n' "$*"; } green() { printf '\033[0;32m%s\033[0m\n' "$*"; } yellow() { printf '\033[0;33m%s\033[0m\n' "$*"; } bold() { printf '\033[1m%s\033[0m\n' "$*"; } # ── Minimum versions (single source of truth for `check` and `fix`) ─────────── PY_MIN="3.9" NODE_MIN_MAJOR=18 PYPDF_MIN="3.0" MARKDOWN_IT_MIN="3.0" # Compare two dotted versions A and B; succeed iff A >= B. ver_ge() { $PY - "$1" "$2" <<'PYEOF' import sys def parts(v): out = [] for chunk in v.split("."): digits = "".join(c for c in chunk if c.isdigit()) out.append(int(digits) if digits else 0) return out a, b = parts(sys.argv[1]), parts(sys.argv[2]) n = max(len(a), len(b)) a += [0] * (n - len(a)) b += [0] * (n - len(b)) sys.exit(0 if a >= b else 1) PYEOF } # Print "OK