#!/usr/bin/env bash
# Collect all files to paste to ChatGPT o1
OUTPUT="gpt.txt"

# Start fresh
> "$OUTPUT"

echo "" >> "$OUTPUT"

# Define the patterns you want to collect files from:
patterns=(
    # "docker-entrypoint.sh"
    # "Dockerfile"
    # "backend/app/*.py"
    # "backend/app/schemas/*.py"
    # "backend/app/api/agent.py"
    # "backend/app/api/frames.py"
    # "backend/app/api/settings.py"
    # "backend/app/ws/*"

    # "backend/app/codegen/app_loader_nim.py"
    # "backend/app/codegen/apps_nim.py"
    # "backend/app/codegen/scene_nim.py"

    # "backend/app/drivers/devices.py"
    # "backend/app/drivers/drivers.py"
    # "backend/app/api/tests/*.py"
    # "backend/app/api/tests/test_frames.py"
    # "backend/app/api/tests/test_settings.py"
    # "backend/app/models/agent.py"
    # "backend/app/models/frame.py"
    # "backend/app/models/settings.py"
    # "backend/app/models/assets.py"
    # "backend/app/utils/ssh_utils.py"
    # "backend/app/utils/local_exec.py"
    # "backend/app/utils/remote_exec.py"
    # "backend/app/tasks/*.py"
    # "backend/app/tasks/_frame_deployer.py"
    # "backend/app/tasks/deploy_agent.py"
    # "backend/app/tasks/deploy_frame.py"
    # "backend/app/tasks/build_sd_card_image.py"
    # "backend/app/models/tests/*.py"
    # "frontend/src/urls.ts"
    # "frontend/src/main.tsx"
    # "frontend/src/types.tsx"
    # "frontend/src/devices.ts"
    # "frontend/src/scenes/frame/panels/FrameSettings/FrameSettings.tsx"
    # "frontend/src/scenes/App.tsx"
    # "frontend/src/scenes/scenes.tsx"
    # "frontend/src/scenes/sceneLogic.tsx"
    # "frameos/src/apps/*/*/config.json"
    # "frameos/src/apps/render/image/*"
    # "frameos/src/apps/render/split/*"
    # "frameos/src/apps/render/calendar/*"
    # "frameos/src/apps/data/frameOSGallery/*"
    # "frameos/src/apps/data/qr/*"
    # "frameos/src/apps/apps.nim"
    # "frameos/frame.json"
    # "frameos/frameos.nimble"
    # "frameos/frameos.service"
    # "frameos/flake.nix"
    # "frameos/flake.lock"
    # "frameos/nixos/*"
    # "frameos/nixos/*/*"
    # "frameos/nixos/*/*/*"
    # "frameos/nixos/*/*/*/*"
    # "frameos/Makefile"
    # "frameos/agent/*"
    # "frameos/agent/src/*"
    # "frameos/src/frameos.nim"
    # "frameos/src/frameos/frameos.nim"
    # "frameos/src/frameos/portal.nim"
    # "frameos/src/frameos/server.nim"
    # "frameos/src/frameos/types.nim"
    # "frameos/src/frameos/config.nim"
    "frameos/src/frameos/types.nim"
    # "frameos/src/frameos/runner.nim"
    # "frameos/src/frameos/scenes.nim"
    # "frameos/src/frameos/values.nim"
    "frameos/src/frameos/interpreter.nim"
    "frameos/src/frameos/js_runtime.nim"
    "frameos/src/lib/burrito.nim"
    # "frameos/src/frameos/utils/*.nim"
    # "frameos/src/scenes/*.nim"
    # "frameos/src/drivers/drivers.nim"
    # "frameos/src/apps/*/*/*"
    # "frameos/src/apps/render/text/*"
    # "frameos/src/apps/render/text/*/*.*"
    # "frontend/src/types.tsx"
    # "e2e/scenes/dataQR*"
    # "e2e/generated/dataQR*"
    # "e2e/scenes/dataDownloadImage*"
    # "e2e/generated/dataDownloadImage*"
)

for pattern in "${patterns[@]}"; do
    for f in $pattern; do
        # Check if the file actually exists and is a regular file
        if [ -f "$f" ]; then
            echo "$f" >> "$OUTPUT"
            echo "-------------" >> "$OUTPUT"
            cat "$f" >> "$OUTPUT"
            echo "-------------" >> "$OUTPUT"
        fi
    done
done

