#!/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 # Seed an empty mounted workspace with the GrowQR Git-backed memory shape. The # backend later clones the user's central Gitea repo over this workspace when it # provisions the user stack. This only runs for truly empty workspaces. if [ -z "$(find "$WORKSPACE" -mindepth 1 -maxdepth 1 2>/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" <