From 7c4852dd49c999fb32e7153bd8938bd046558e5e Mon Sep 17 00:00:00 2001 From: Bram Kelchtermans Date: Wed, 7 Oct 2026 16:09:08 +0200 Subject: [PATCH] roo code patch laravel container --- Dockers/remote-laravel-container/Dockerfile | 5 ++ .../remote-laravel-container/entrypoint.sh | 4 + .../patch-roo-code.sh | 76 +++++++++++++++++++ Dockers/remote-laravel-container/version | 2 +- 4 files changed, 86 insertions(+), 1 deletion(-) create mode 100755 Dockers/remote-laravel-container/patch-roo-code.sh diff --git a/Dockers/remote-laravel-container/Dockerfile b/Dockers/remote-laravel-container/Dockerfile index bb32e6c..69ed110 100644 --- a/Dockers/remote-laravel-container/Dockerfile +++ b/Dockers/remote-laravel-container/Dockerfile @@ -22,6 +22,7 @@ RUN apt-get update && apt-get install -y \ fish \ cron \ sudo \ + ripgrep \ && docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install gd mbstring zip pdo pdo_mysql pdo_pgsql pgsql intl bcmath pcntl sockets @@ -66,6 +67,10 @@ RUN mkdir -p /root/.ssh COPY entrypoint.sh /usr/local/bin/entrypoint.sh RUN chmod +x /usr/local/bin/entrypoint.sh +# Patch script: make Roo Code use the system ripgrep (fixes "Could not find ripgrep binary") +COPY patch-roo-code.sh /usr/local/bin/patch-roo-code.sh +RUN chmod +x /usr/local/bin/patch-roo-code.sh + # Copy the crontab file into the container COPY crontab /etc/cron.d/laravel-cron RUN chmod 0644 /etc/cron.d/laravel-cron diff --git a/Dockers/remote-laravel-container/entrypoint.sh b/Dockers/remote-laravel-container/entrypoint.sh index 8b6db84..e0b2589 100644 --- a/Dockers/remote-laravel-container/entrypoint.sh +++ b/Dockers/remote-laravel-container/entrypoint.sh @@ -173,5 +173,9 @@ add_teleport_labels service cron start nohup teleport start & +# Keep the Roo Code remote extension patched to use system ripgrep +# (watcher mode: patches automatically when the extension is (re)installed) +nohup /usr/local/bin/patch-roo-code.sh --watch >/var/log/patch-roo-code.log 2>&1 & + # Start the application with pm2 exec pm2-runtime "php -t public -S 0.0.0.0:8000" diff --git a/Dockers/remote-laravel-container/patch-roo-code.sh b/Dockers/remote-laravel-container/patch-roo-code.sh new file mode 100755 index 0000000..33f5350 --- /dev/null +++ b/Dockers/remote-laravel-container/patch-roo-code.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# +# patch-roo-code.sh +# +# Roo Code (rooveterinaryinc.roo-cline) looks for a bundled ripgrep binary and +# throws "Could not find ripgrep binary" inside remote/dev containers. This +# script patches the remote extension.js so it uses the system-installed +# ripgrep instead. +# +# Usage: +# patch-roo-code.sh One-shot patch (idempotent, safe to re-run) +# patch-roo-code.sh --watch Keep watching for (re)installs/updates of the +# extension and patch automatically +# +# Environment overrides: +# RG_PATH ripgrep binary to inject (default: /usr/bin/rg) +# EXT_ROOT VS Code server extensions dir (default: $HOME/.vscode-server/extensions) +# PATCH_ROO_INTERVAL poll interval in seconds for --watch (default: 30) + +set -u + +RG_PATH="${RG_PATH:-/usr/bin/rg}" +EXT_ROOT="${EXT_ROOT:-$HOME/.vscode-server/extensions}" + +# Returns: 0 = patched, 1 = already patched / string not found, 2 = extension not found +patch_once() { + local roo_remote_js + roo_remote_js=$(ls -d "$EXT_ROOT"/rooveterinaryinc.roo-cline-*/dist/extension.js 2>/dev/null | tail -n1) + + if [ -z "$roo_remote_js" ]; then + echo "Roo Code extensie niet gevonden in $EXT_ROOT." + return 2 + fi + + if ! grep -q 'Could not find ripgrep binary' "$roo_remote_js"; then + echo "String al aangepast of niet gevonden." + return 1 + fi + + if command -v python3 >/dev/null 2>&1; then + python3 - "$roo_remote_js" "$RG_PATH" <<'PYEOF' +import sys + +path, rg_path = sys.argv[1], sys.argv[2] + +with open(path, 'r') as f: + code = f.read() + +patched = code.replace( + 'throw new Error("Could not find ripgrep binary")', + 'return "%s"' % rg_path, +) + +with open(path, 'w') as f: + f.write(patched) +PYEOF + else + sed -i "s|throw new Error(\"Could not find ripgrep binary\")|return \"$RG_PATH\"|g" "$roo_remote_js" + fi + + echo "Remote Roo Code succesvol gepatcht op de server! ($roo_remote_js)" + return 0 +} + +if [ "${1:-}" = "--watch" ]; then + # The extension is installed/updated at runtime (when VS Code connects), so + # poll periodically and only log when an actual patch was applied. + while true; do + if patch_once >/dev/null 2>&1; then + echo "[$(date '+%Y-%m-%d %H:%M:%S')] Remote Roo Code succesvol gepatcht op de server!" + fi + sleep "${PATCH_ROO_INTERVAL:-30}" + done +fi + +patch_once diff --git a/Dockers/remote-laravel-container/version b/Dockers/remote-laravel-container/version index e8f1734..913671c 100644 --- a/Dockers/remote-laravel-container/version +++ b/Dockers/remote-laravel-container/version @@ -1 +1 @@ -6.1 \ No newline at end of file +6.2 \ No newline at end of file