CoolFace
Apppublic

build-small-hackathon/microfactory-lab

sourceHugging Facemitupdated 3mo agoView on Hugging Face
2likes
record-studio.sh72 linesDownload Raw Back to root
1#!/usr/bin/env bash2# One-liner studio recording for WSL + Windows Chrome + Cap Desktop.3#4# This script:5#   1. Sources the cap-cli-skill so `cap` is available.6#   2. Discovers the Windows host IP from WSL's default gateway.7#   3. Launches Chrome in app mode pointed at https://node.microfactory.space8#      with remote debugging enabled (if not already running).9#   4. Runs the Node-based studio driver, which uses npm/pnpm-based Playwright,10#      starts a Cap screen recording if none is active, warms the GPU via the11#      WARM UP button, then drives the full demo. It leaves the raw .cap12#      project — no export.13#14# Usage:15#   ./record-studio.sh16#   ./record-studio.sh --beat=317#   ./record-studio.sh --beat=placement --pause=418#19# Prerequisites:20#   Chrome installed at C:\Program Files\Google\Chrome\Application\chrome.exe21#   Cap CLI set up via ~/projects/cap-cli-skill/setup.sh22 23set -euo pipefail24 25cd "$(dirname "$0")"26 27source ~/projects/cap-cli-skill/setup.sh 2>/dev/null || true28 29HOST_IP=$(ip route show | grep default | awk '{print $3}')30CDP_URL="http://${HOST_IP}:9222"31CHROME="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"32SPACE="https://node.microfactory.space/?__theme=dark"33 34echo "Windows host IP: ${HOST_IP}"35echo "CDP URL: ${CDP_URL}"36 37# Screen resolution from Cap target; adjust if your display differs.38SCREEN_W=170739SCREEN_H=106740 41# Launch Chrome in app mode with CDP if CDP is not already alive42if ! curl -s "${CDP_URL}/json/version" >/dev/null 2>&1; then43    echo "Launching Chrome app window..."44    PROFILE_DIR="/tmp/chrome-studio-profile-$(date +%s)"45    mkdir -p "$PROFILE_DIR"46    nohup "${CHROME}" --app="${SPACE}" --remote-debugging-port=9222 \47        --remote-debugging-address=0.0.0.0 \48        --user-data-dir="$PROFILE_DIR" \49        --window-size=${SCREEN_W},${SCREEN_H} \50        --window-position=0,0 \51        --disable-session-crashed-bubble --no-first-run \52        --no-default-browser-check --disable-features=TranslateUI \53        >/tmp/chrome-studio.log 2>&1 &54    sleep 555else56    echo "Chrome CDP already alive — reusing existing window"57fi58 59# Install Node deps if Playwright is not resolvable60if ! node -e "require.resolve('playwright')" >/dev/null 2>&1; then61    echo "Installing Playwright (pnpm/npm)..."62    if command -v pnpm &> /dev/null; then63        pnpm install64    else65        npm install66    fi67    npx playwright install chromium68fi69 70echo "Starting studio recording..."71CDP_URL="${CDP_URL}" node scripts/record-studio.cjs "$@"72