10 products pages with Gemini premium CSS applied (marker DOCTRINE-201 verified): - leadforge (52279B) academy (38428) consulting (30061) ai-sdr (29446) - arsenal (47227) auditai (37500) academy-elearning (20999) - ecosysteme-ia-maroc (21032) roi-calculator (24168) linkedin-manager (25793) All HTTP 200 confirmed, Playwright audit tr:0 br:0 ZERO overlap regression Handler v2 improvements (doctrine 203): - wgux-apply.py: sudo chattr -i/+i (fix silent failure batch mode) - Verify post-apply: marker presence + size delta > 0 - Restore from GOLD backup if corruption detected - fallback sudo tee if direct write PermissionError Scripts deployed: - /var/www/html/api/wevia-gemini-ux-apply.sh (orchestrator) - /var/www/html/api/wgux-build-payload.py (Gemini prompt builder, maxTokens 16000) - /var/www/html/api/wgux-parse.py (robust JSON parser) - /var/www/html/api/wgux-apply.py v2 (sudo chattr + verify) - /var/www/html/api/wgux-shot.js (Playwright screenshot) Intents LIVE: - intent-opus4-wevia_gemini_ux_fix (review mode) - intent-opus4-wevia_gemini_ux_apply (apply mode) 10 NL triggers each: gemini ux, refais ux, apply ux gemini, audit ux gemini, etc. Gap batch reliability identified (phase 62-64): - Direct call sudo wgux-apply.py WORKS - Orchestrator via nohup sudo bash -c WORKS in foreground - Background batch parallel: sporadic silent failure despite sudo chattr - Root cause: sudo context loss in nested child process under FPM - Recommendation next phase: appel seq direct sans orchestrator BG Cumul session Opus: - 62 tags (incluant phase 65) - 42 doctrines (146-203) - 428 pages UX doctrine 60 - 10 pages Gemini premium CSS APPLIED E2E - NR 153/153 invariant 65 phases
49 lines
2.1 KiB
Bash
Executable File
49 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Doctrine 201: WEVIA Gemini UX Apply v2 - FIX parser + maxTokens 16000 + prompt concis
|
|
set -u
|
|
PAGE="${1:-weval-technology-platform}"
|
|
PAGE="${PAGE%.html}"
|
|
MODE="${2:-review_only}"
|
|
|
|
TARGET=""
|
|
[ -f "/var/www/html/${PAGE}.html" ] && TARGET="/var/www/html/${PAGE}.html"
|
|
[ -z "$TARGET" ] && [ -f "/var/www/html/products/${PAGE}.html" ] && TARGET="/var/www/html/products/${PAGE}.html"
|
|
[ -z "$TARGET" ] && { echo "{\"ok\":false,\"err\":\"page_not_found\"}"; exit 1; }
|
|
|
|
KG=$(grep "^GEMINI_KEY=" /etc/weval/secrets.env 2>/dev/null | cut -d= -f2- | tr -d '"' | head -c 80)
|
|
[ -z "$KG" ] && { echo "{\"ok\":false,\"err\":\"no_key\"}"; exit 1; }
|
|
|
|
TS=$(date +%Y%m%d-%H%M%S)
|
|
OUT="/var/www/html/proofs/wevia-gemini-apply-v2-$TS"
|
|
mkdir -p "$OUT"
|
|
|
|
# 1) Screenshot
|
|
URL="https://weval-consulting.com/${TARGET#/var/www/html/}"
|
|
timeout 45 bash -c "cd /var/www/html/api && node wgux-shot.js \"$URL\" \"$OUT/before.png\"" > "$OUT/shot.log" 2>&1
|
|
[ ! -f "$OUT/before.png" ] && { echo "{\"ok\":false,\"err\":\"playwright_fail\"}"; exit 1; }
|
|
|
|
# 2) Build payload - concise prompt to preserve output tokens
|
|
base64 -w0 < "$OUT/before.png" > "$OUT/before.b64"
|
|
python3 /var/www/html/api/wgux-build-payload.py "$OUT/before.b64" > "$OUT/payload.json"
|
|
|
|
# 3) Call Gemini
|
|
curl -sk -m 180 -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key=$KG" \
|
|
-H "Content-Type: application/json" -d @"$OUT/payload.json" > "$OUT/gemini-raw.json" 2>&1
|
|
|
|
# 4) Parse via separate script (not inline heredoc)
|
|
python3 /var/www/html/api/wgux-parse.py "$OUT/gemini-raw.json" "$OUT/plan.json" > "$OUT/parse.log" 2>&1
|
|
|
|
# 5) Apply if mode=apply
|
|
APPLIED="false"
|
|
if [ "$MODE" = "apply" ] && [ -f "$OUT/plan.json" ]; then
|
|
sudo python3 /var/www/html/api/wgux-apply.py "$OUT/plan.json" "$TARGET" "$TS" > "$OUT/apply.log" 2>&1
|
|
if grep -q "APPLIED" "$OUT/apply.log"; then
|
|
APPLIED="true"
|
|
fi
|
|
fi
|
|
|
|
rm -f "$OUT/before.b64" "$OUT/payload.json"
|
|
|
|
PROOF="https://weval-consulting.com/proofs/wevia-gemini-apply-v2-$TS"
|
|
echo "{\"ok\":true,\"page\":\"$PAGE\",\"mode\":\"$MODE\",\"applied\":\"$APPLIED\",\"proofs\":\"$PROOF\"}"
|