website-builder-backend / 21_integrate_dolor3v_engine.sh
David Prince
fix: add all missing local module stubs (remote_mcp_registry, mcp_auth, mcp_transport, etc)
cce8120
Raw
History Blame Contribute Delete
2.13 kB
#!/usr/bin/env bash
set -Eeuo pipefail
ROOT="/root/projects/website-builder-backend-clean"
BACKEND="$ROOT/backend"
echo "========================================"
echo "Dolor3V Production Integration"
echo "========================================"
require() {
[ -e "$1" ] || {
echo "Missing: $1"
exit 1
}
}
require "$BACKEND/main.py"
require "$BACKEND/llm/gateway.py"
mkdir -p "$ROOT/backups"
STAMP="$(date +%Y%m%d-%H%M%S)"
cp "$BACKEND/main.py" \
"$ROOT/backups/main.py.$STAMP"
cp "$BACKEND/llm/gateway.py" \
"$ROOT/backups/gateway.py.$STAMP"
python3 <<'PY'
from pathlib import Path
main = Path("backend/main.py")
text = main.read_text()
imports = """
from backend.agents.orchestrator import Orchestrator
from backend.llm.gateway import LLMGateway
"""
if "from backend.agents.orchestrator import Orchestrator" not in text:
idx = text.find("app = FastAPI")
if idx != -1:
text = text[:idx] + imports + "\n" + text[idx:]
boot = """
# -------- Dolor3V Engine --------
llm_gateway = LLMGateway()
dolor3v = Orchestrator(
gateway=llm_gateway
)
app.state.dolor3v = dolor3v
"""
if "app.state.dolor3v" not in text:
idx = text.find("app = FastAPI")
if idx != -1:
end = text.find("\n", idx)
text = text[:end+1] + boot + text[end+1:]
main.write_text(text)
print("Integrated Dolor3V Engine")
PY
python3 <<'PY'
from pathlib import Path
gateway = Path("backend/llm/gateway.py")
text = gateway.read_text()
REMOVE = [
"gemini",
"google.generativeai",
"GenerativeModel",
]
for token in REMOVE:
text = text.replace(token, "__REMOVED__")
gateway.write_text(text)
print("Gemini disabled")
PY
python3 -m compileall backend >/dev/null
echo
echo "========================================"
echo "Verification"
echo "========================================"
python3 <<'PY'
import importlib
mods = [
"backend.main",
"backend.agents.orchestrator",
"backend.llm.gateway",
]
for m in mods:
try:
importlib.import_module(m)
print("[OK]",m)
except Exception as e:
print("[FAIL]",m,e)
PY
echo
echo "Completed."