8181ARG OPENCODE_VERSION=latest
8282ARG CAVEMAN_VERSION=latest
8383ARG AZURE_FOUNDRY_PROVIDER_REF=v0.4.0
84+ ARG PONYTAIL_VERSION=latest
8485ARG ENGRAM_VERSION=latest
8586ARG OPENCODE_BUILD_DIR=/usr/local/share/opencode-build
8687
@@ -194,10 +195,13 @@ caveman_resolved_version=$(resolve_github_latest_version "JuliusBrussee/caveman"
194195echo "CAVEMAN_RESOLVED_REF=${caveman_resolved_version}"
195196echo "${caveman_resolved_version}" > /tmp/caveman_version
196197
197- mkdir -p "${OPENCODE_CONFIG_DIR}/plugins/caveman" "${OPENCODE_CONFIG_DIR}/commands"
198+ mkdir -p "${OPENCODE_CONFIG_DIR}/plugins/caveman" "${OPENCODE_CONFIG_DIR}/commands" "${OPENCODE_CONFIG_DIR}/agents"
198199
199200CAVEMAN_RAW_BASE="https://raw.githubusercontent.com/JuliusBrussee/caveman/refs/tags/${caveman_resolved_version}"
200201
202+ # AGENTS.md — always-on caveman ruleset (auto-discovered by opencode)
203+ curl -fsSL "${CAVEMAN_RAW_BASE}/src/rules/caveman-activate.md" -o "${OPENCODE_CONFIG_DIR}/AGENTS.md" || exit 1
204+
201205{
202206 curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/package.json" -o "${OPENCODE_CONFIG_DIR}/plugins/caveman/package.json"
203207 curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/plugin.js" -o "${OPENCODE_CONFIG_DIR}/plugins/caveman/plugin.js"
@@ -207,6 +211,10 @@ CAVEMAN_RAW_BASE="https://raw.githubusercontent.com/JuliusBrussee/caveman/refs/t
207211 curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/commands/caveman-review.md" -o "${OPENCODE_CONFIG_DIR}/commands/caveman-review.md"
208212 curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/commands/caveman-stats.md" -o "${OPENCODE_CONFIG_DIR}/commands/caveman-stats.md"
209213 curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/commands/caveman-help.md" -o "${OPENCODE_CONFIG_DIR}/commands/caveman-help.md"
214+ # cavecrew subagents — strip `tools:` frontmatter (opencode rejects YAML array form)
215+ curl -fsSL "${CAVEMAN_RAW_BASE}/agents/cavecrew-investigator.md" | sed '/^tools:/,/^[^ ]/ { /^tools:/d; /^ /d; }' > "${OPENCODE_CONFIG_DIR}/agents/cavecrew-investigator.md"
216+ curl -fsSL "${CAVEMAN_RAW_BASE}/agents/cavecrew-builder.md" | sed '/^tools:/,/^[^ ]/ { /^tools:/d; /^ /d; }' > "${OPENCODE_CONFIG_DIR}/agents/cavecrew-builder.md"
217+ curl -fsSL "${CAVEMAN_RAW_BASE}/agents/cavecrew-reviewer.md" | sed '/^tools:/,/^[^ ]/ { /^tools:/d; /^ /d; }' > "${OPENCODE_CONFIG_DIR}/agents/cavecrew-reviewer.md"
210218} & wait || exit 1
211219
212220cat > "${OPENCODE_CONFIG_DIR}/commands/caveman-compress.md" <<'EOF'
@@ -222,6 +230,40 @@ Preserve code, URLs, paths, commands, and structure exactly as the skill require
222230Overwrite the original file only if the compression succeeds, and keep the `.original.md` backup.
223231EOF
224232
233+ # ##
234+ # ponytail
235+ #
236+ ponytail_resolved_version=$(resolve_github_latest_version "DietrichGebert/ponytail" "${PONYTAIL_VERSION}" ) || exit 1
237+ echo "PONYTAIL_RESOLVED_REF=${ponytail_resolved_version}"
238+
239+ PONYTAIL_RAW_BASE="https://raw.githubusercontent.com/DietrichGebert/ponytail/refs/tags/${ponytail_resolved_version}"
240+
241+ mkdir -p "${OPENCODE_CONFIG_DIR}/plugins/ponytail/hooks" \
242+ "${OPENCODE_CONFIG_DIR}/plugins/ponytail/skills/ponytail" \
243+ "${OPENCODE_CONFIG_DIR}/commands" \
244+ "${OPENCODE_CONFIG_DIR}/skills/ponytail-review" \
245+ "${OPENCODE_CONFIG_DIR}/skills/ponytail-help"
246+
247+ curl -fsSL "${PONYTAIL_RAW_BASE}/.opencode/plugins/ponytail.mjs" \
248+ | sed 's|../../hooks/|./ponytail/hooks/|g' \
249+ > "${OPENCODE_CONFIG_DIR}/plugins/ponytail.mjs" \
250+ || exit 1
251+ grep -qF './ponytail/hooks/' "${OPENCODE_CONFIG_DIR}/plugins/ponytail.mjs" \
252+ || {
253+ echo "[ponytail] FATAL: import patch failed — ../../hooks/ not replaced. Plugin version may have changed."
254+ exit 1;
255+ }
256+
257+ {
258+ curl -fsSL "${PONYTAIL_RAW_BASE}/hooks/ponytail-instructions.js" -o "${OPENCODE_CONFIG_DIR}/plugins/ponytail/hooks/ponytail-instructions.js"
259+ curl -fsSL "${PONYTAIL_RAW_BASE}/hooks/ponytail-config.js" -o "${OPENCODE_CONFIG_DIR}/plugins/ponytail/hooks/ponytail-config.js"
260+ curl -fsSL "${PONYTAIL_RAW_BASE}/skills/ponytail/SKILL.md" -o "${OPENCODE_CONFIG_DIR}/plugins/ponytail/skills/ponytail/SKILL.md"
261+ curl -fsSL "${PONYTAIL_RAW_BASE}/.opencode/command/ponytail.md" -o "${OPENCODE_CONFIG_DIR}/commands/ponytail.md"
262+ curl -fsSL "${PONYTAIL_RAW_BASE}/.opencode/command/ponytail-review.md" -o "${OPENCODE_CONFIG_DIR}/commands/ponytail-review.md"
263+ curl -fsSL "${PONYTAIL_RAW_BASE}/skills/ponytail-review/SKILL.md" -o "${OPENCODE_CONFIG_DIR}/skills/ponytail-review/SKILL.md"
264+ curl -fsSL "${PONYTAIL_RAW_BASE}/skills/ponytail-help/SKILL.md" -o "${OPENCODE_CONFIG_DIR}/skills/ponytail-help/SKILL.md"
265+ } & wait || exit 1
266+
225267# ##
226268# cleanup
227269rm -rf /root/.bun
@@ -245,6 +287,7 @@ rm -rf "${OPENCODE_BUILD_DIR}"
245287cat >"${OPENCODE_CONFIG_DIR}/opencode.json" <<-'EOF'
246288{
247289 "$schema" : "https://opencode.ai/config.json" ,
290+ "autoupdate" : false,
248291 "plugin" : [
249292 "file:///usr/local/bun/install/global/node_modules/opencode-gemini-auth" ,
250293 "file:///etc/opencode/plugins/caveman"
0 commit comments