Skip to content

Commit caba351

Browse files
committed
feat(docker): add caveman plugin integration
Add caveman plugin to the Docker image with version resolution, file downloads, and opencode.json registration. Also fixes the npx symlink command and updates the Azure Foundry provider to v0.4.0.
1 parent bd2630a commit caba351

1 file changed

Lines changed: 47 additions & 2 deletions

File tree

Dockerfile

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ENV PATH="${PATH}:${PYTHON_DIR}/bin"
1414
RUN <<'FOE'
1515

1616
ln -s /usr/local/bin/bun /usr/local/bin/node
17-
ls -s /usr/local/bin/bun /usr/local/bin/npx
17+
ln -s /usr/local/bin/bun /usr/local/bin/npx
1818

1919
apt-get update
2020
apt-get install \
@@ -79,7 +79,8 @@ EOF
7979
FOE
8080

8181
ARG OPENCODE_VERSION=latest
82-
ARG AZURE_FOUNDRY_PROVIDER_REF=v0.3.1
82+
ARG CAVEMAN_VERSION=latest
83+
ARG AZURE_FOUNDRY_PROVIDER_REF=v0.4.0
8384
ARG ENGRAM_VERSION=latest
8485
ARG OPENCODE_BUILD_DIR=/usr/local/share/opencode-build
8586

@@ -116,6 +117,10 @@ resolve_github_latest_version() {
116117
echo "${version}"
117118
}
118119

120+
resolve_caveman_version() {
121+
resolve_github_latest_version "JuliusBrussee/caveman" "${CAVEMAN_VERSION}"
122+
}
123+
119124
mkdir -p "${BUN_INSTALL}" "${OPENCODE_CONFIG_DIR}" "${OPENCODE_PLUGINS_DIR}" "${PROVIDER_DIR}"
120125
chmod 0777 "${OPENCODE_CONFIG_DIR}"
121126

@@ -185,6 +190,41 @@ curl -fsSL "https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/hooks
185190
# vercel/skills
186191
bun install -g --trust skills@latest
187192

193+
###
194+
# caveman
195+
#
196+
caveman_resolved_version=$(resolve_caveman_version) || exit 1
197+
echo "CAVEMAN_RESOLVED_REF=${caveman_resolved_version}"
198+
echo "${caveman_resolved_version}" > /tmp/caveman_version
199+
200+
mkdir -p "${OPENCODE_CONFIG_DIR}/plugins/caveman" "${OPENCODE_CONFIG_DIR}/commands"
201+
202+
CAVEMAN_RAW_BASE="https://raw.githubusercontent.com/JuliusBrussee/caveman/refs/tags/${caveman_resolved_version}"
203+
204+
{
205+
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/package.json" -o "${OPENCODE_CONFIG_DIR}/plugins/caveman/package.json"
206+
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/plugin.js" -o "${OPENCODE_CONFIG_DIR}/plugins/caveman/plugin.js"
207+
curl -fsSL "${CAVEMAN_RAW_BASE}/src/hooks/caveman-config.js" -o "${OPENCODE_CONFIG_DIR}/plugins/caveman/caveman-config.cjs"
208+
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/commands/caveman.md" -o "${OPENCODE_CONFIG_DIR}/commands/caveman.md"
209+
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/commands/caveman-commit.md" -o "${OPENCODE_CONFIG_DIR}/commands/caveman-commit.md"
210+
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/commands/caveman-review.md" -o "${OPENCODE_CONFIG_DIR}/commands/caveman-review.md"
211+
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/commands/caveman-stats.md" -o "${OPENCODE_CONFIG_DIR}/commands/caveman-stats.md"
212+
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/commands/caveman-help.md" -o "${OPENCODE_CONFIG_DIR}/commands/caveman-help.md"
213+
} & wait || exit 1
214+
215+
cat > "${OPENCODE_CONFIG_DIR}/commands/caveman-compress.md" <<'EOF'
216+
---
217+
description: Compress a Markdown memory file using the caveman-compress skill
218+
---
219+
Compress the target file with `caveman-compress`.
220+
221+
Input: `$ARGUMENTS`
222+
223+
Run the installed `caveman-compress` skill workflow against the given file path.
224+
Preserve code, URLs, paths, commands, and structure exactly as the skill requires.
225+
Overwrite the original file only if the compression succeeds, and keep the `.original.md` backup.
226+
EOF
227+
188228
###
189229
# cleanup
190230
rm -rf /root/.bun
@@ -199,6 +239,10 @@ COPY skills.yaml "${OPENCODE_BUILD_DIR}/skills.yaml"
199239
RUN <<'FOE'
200240
source /etc/bash.bashrc
201241

242+
CAVEMAN_RESOLVED_REF=$(cat /tmp/caveman_version)
243+
244+
export CAVEMAN_RESOLVED_REF
245+
202246
BUN_INSTALL=/tmp/bun bun install --cwd "${OPENCODE_BUILD_DIR}/scripts" yaml || exit 1
203247
bun "${OPENCODE_BUILD_DIR}/scripts/install-skills.ts" || exit 1
204248

@@ -210,6 +254,7 @@ cat >"${OPENCODE_CONFIG_DIR}/opencode.json" <<-'EOF'
210254
"$schema": "https://opencode.ai/config.json",
211255
"plugin": [
212256
"file:///usr/local/bun/install/global/node_modules/opencode-gemini-auth",
257+
"file:///etc/opencode/plugins/caveman"
213258
],
214259
"mcp": {
215260
"engram": {

0 commit comments

Comments
 (0)