diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cef2a00..7e614b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -127,7 +127,7 @@ jobs: add_image "ralphex-fe" \ "ralphex-fe" \ "ralphex-fe/Dockerfile" \ - "bun --version && hugo version && /srv/ralphex --version" + "bun --version && hugo version && /srv/ralphex --version && rtk --version" fi if [ "$INCLUDES" = "[]" ]; then diff --git a/ralphex-fe/Dockerfile b/ralphex-fe/Dockerfile index 3b7157e..91a8938 100644 --- a/ralphex-fe/Dockerfile +++ b/ralphex-fe/Dockerfile @@ -43,6 +43,22 @@ RUN set -eux; \ fi; \ tar -xzf hugo.tar.gz -C /usr/local/bin/ hugo +# ── RTK (token-optimized CLI proxy for Claude Code) ───────────────────────── +# Pattern from: .devcontainer/Dockerfile +FROM alpine:3.21 AS rtk-download +RUN apk add --no-cache curl jq +RUN set -eux; \ + ARCH="$(uname -m)"; \ + case "$ARCH" in \ + x86_64) RTK_TARGET="x86_64-unknown-linux-musl" ;; \ + aarch64) RTK_TARGET="aarch64-unknown-linux-gnu" ;; \ + esac; \ + RTK_VERSION=$(curl -fsSL https://api.github.com/repos/rtk-ai/rtk/releases/latest \ + | jq -r '.tag_name' | sed 's/^v//'); \ + curl -fsSL -o /tmp/rtk.tar.gz \ + "https://github.com/rtk-ai/rtk/releases/download/v${RTK_VERSION}/rtk-${RTK_TARGET}.tar.gz"; \ + tar -xzf /tmp/rtk.tar.gz -C /usr/local/bin rtk + # ── Ralphex binary (latest from GitHub Releases) ──────────────────────────── # Pattern from: claude-code/.devcontainer/Dockerfile FROM alpine:3.21 AS ralphex-download @@ -117,6 +133,7 @@ COPY --from=go-download /usr/local/go /usr/local/go COPY --from=docker-download /usr/local/bin/docker /usr/local/bin/docker COPY --from=hugo-download /usr/local/bin/hugo /usr/local/bin/hugo COPY --from=ralphex-download /usr/local/bin/ralphex /srv/ralphex +COPY --from=rtk-download /usr/local/bin/rtk /usr/local/bin/rtk ENV GOROOT=/usr/local/go \ GOPATH=/home/app/go diff --git a/ralphex-fe/README.md b/ralphex-fe/README.md index ab558a1..f248aed 100644 --- a/ralphex-fe/README.md +++ b/ralphex-fe/README.md @@ -17,6 +17,7 @@ This is a standalone image, not a devcontainer. | Python 3 | system | | Playwright + Chromium | native Debian | | Claude Code CLI | latest | +| RTK | latest (GitHub Releases) | | Ralphex | latest (GitHub Releases) | | Git, ripgrep, jq, curl, wget | system | diff --git a/ralphex-fe/init-docker.sh b/ralphex-fe/init-docker.sh index dfaece2..fe5a66f 100755 --- a/ralphex-fe/init-docker.sh +++ b/ralphex-fe/init-docker.sh @@ -27,6 +27,13 @@ if [ -d /mnt/claude ]; then fi chown -R app:app /home/app/.claude + + # ── RTK: ensure rewrite hook is configured ───────────────────────────── + # Host mount usually brings the hook, but init idempotently to cover + # standalone usage (no host mount). Runs as app user for correct paths. + if command -v rtk >/dev/null 2>&1; then + gosu app rtk init -g --auto-patch 2>/dev/null || true + fi fi # copy credentials extracted from macOS keychain (mounted separately)