rhodawk-ai-devops-engine / scripts /generate_stubs.sh
Rhodawk Agent
fix(playbook §10): resolve all 12 diagnostic warnings W-001..W-012\n\n W-001 CRITICAL: Add scripts/generate_stubs.sh + Makefile to generate\n openclaude_grpc/openclaude_pb2*.py locally without a full Docker build.\n W-002 HIGH: Delete dead Rhodawk_AI_Pitch_Deck_2026.pptx (operator request).\n W-003 HIGH: Rename mcp_config.json -> mcp_config.ARCHIVE.json with archive notice.\n W-004 HIGH: formal_verifier.py — RHODAWK_Z3_ENABLED defaults to true; loud warning if skipped.\n W-005 MEDIUM: Surface RHODAWK_AUTO_MERGE state in System Status banner.\n W-006 MEDIUM: training_store.PgConn.executescript() splits multi-stmt SQL.\n W-007 MEDIUM: webhook_server returns 403 + JSON when secret unset.\n W-008 MEDIUM: hermes_orchestrator — new HERMES_PROVIDER routing flag.\n W-009 MEDIUM: New night_hunt_lock.py shared mutex across both night-hunt loops.\n W-010 MEDIUM: repo_harvester uses dynamic 30-day rolling pushed window.\n W-011 MEDIUM: lora_scheduler emits Telegram/Slack notification on export.\n W-012 MEDIUM: Live Operations tab shows System Status feature-gate banner.
6ed9a00
Raw
History Blame Contribute Delete
1.97 kB
#!/usr/bin/env bash
# ============================================================================
# Rhodawk AI — Local gRPC Stub Generator
# ----------------------------------------------------------------------------
# Resolves W-001 (CRITICAL): the openclaude_grpc/openclaude_pb2.py and
# openclaude_grpc/openclaude_pb2_grpc.py files are NOT committed to source
# (they are generated at Docker build time). This script generates them
# locally so app.py can be imported and run without a full Docker build.
#
# Usage:
# bash scripts/generate_stubs.sh
#
# Requirements:
# pip install grpcio-tools
# ============================================================================
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
PROTO_DIR="${REPO_ROOT}/vendor/openclaude/src/proto"
OUT_DIR="${REPO_ROOT}/openclaude_grpc"
if [ ! -f "${PROTO_DIR}/openclaude.proto" ]; then
echo "[generate_stubs] ERROR: ${PROTO_DIR}/openclaude.proto not found." >&2
echo "[generate_stubs] The vendor/openclaude submodule may be missing." >&2
exit 1
fi
if ! python -c "import grpc_tools" 2>/dev/null; then
echo "[generate_stubs] ERROR: grpcio-tools not installed." >&2
echo "[generate_stubs] Run: pip install grpcio-tools" >&2
exit 1
fi
mkdir -p "${OUT_DIR}"
echo "[generate_stubs] Generating Python gRPC stubs..."
python -m grpc_tools.protoc \
-I "${PROTO_DIR}" \
--python_out="${OUT_DIR}" \
--grpc_python_out="${OUT_DIR}" \
"${PROTO_DIR}/openclaude.proto"
# Patch the generated _grpc.py to use a relative import so it works as a
# package module (the protoc default emits an absolute import).
GRPC_FILE="${OUT_DIR}/openclaude_pb2_grpc.py"
if [ -f "${GRPC_FILE}" ]; then
sed -i.bak 's/^import openclaude_pb2 as openclaude__pb2$/from . import openclaude_pb2 as openclaude__pb2/' "${GRPC_FILE}"
rm -f "${GRPC_FILE}.bak"
fi
echo "[generate_stubs] Done. Generated:"
ls -la "${OUT_DIR}"/openclaude_pb2*.py