#!/usr/bin/env sh set -eu WORKSPACE="${OPENCODE_WORKSPACE:-/workspace}" GROWQR_HOME="${GROWQR_HOME:-/opt/growqr}" TEMPLATE="$GROWQR_HOME/workspace-template" mkdir -p "$WORKSPACE" /root/.config/opencode /root/.local/share/opencode # Make sub-agents discoverable from common OpenCode/global locations. We keep # the canonical copy in /opt/growqr and symlink/copy to config paths so future # OpenCode versions can pick up either convention. ln -sfn "$GROWQR_HOME/agents" /root/.config/opencode/agents ln -sfn "$GROWQR_HOME/prompts" /root/.config/opencode/prompts ln -sfn "$GROWQR_HOME/agents" /root/.local/share/opencode/agents ln -sfn "$GROWQR_HOME/prompts" /root/.local/share/opencode/prompts # OpenCode runs with /workspace as the project root. GrowQR prompt packs live in # /opt/growqr, so allow read/glob/grep access there without interactive approval; # otherwise backend API calls can hang waiting on an approval prompt. cat > /root/.config/opencode/opencode.jsonc </dev/null | head -n 1)" ]; then cp -a "$TEMPLATE"/. "$WORKSPACE"/ cat > "$WORKSPACE/README.md" </dev/null 2>&1 || true git -C "$WORKSPACE" config user.email "growqr@local" || true git -C "$WORKSPACE" config user.name "GrowQR" || true git -C "$WORKSPACE" add -A >/dev/null 2>&1 || true git -C "$WORKSPACE" commit -m "init: growqr workspace template" >/dev/null 2>&1 || true fi cat > "$WORKSPACE/.growqr-runtime.json" <