Files
Nang ef2ca58d7c Creator mode (#271)
* feat: created creator overlay code container code

* WIP: message shows when the creator overview is toggled

* chore: commented code

* WIP: Creator overlay

* fix: z-index/display issues when overlay is initialized

* feat: added hideLoadingOverlay functionality to hide the loading messaging when the react loads in

* feat: creaded creator mode view

* fix: pear ai creator mode layout fixed

* fix: no centered code editor

* refactor: cleanup

* chore: added in TODO to remove shizz before deployment

* WIP: creator overlay slide down

* fix: infinite loop

* chore: removed loading text references

* chore: good enough for 'stralia

* chore: removed unused variable

* feat: setting default theme to dark on startup

* fix: setting dark mode properly on first launch

* chore: autoformat + commented out shizz

* chore: updated CREATOR_VIEW_ID to align with submodule

* fix: bumped version of tree sitter

* chore: dev deps

* chore: removed unused import

* feat: improved styling for creator mode overlay

* WIP: creator mode button

* feat: added command emitter to simplify sending commands

* WIP: overlay appearance

* WIP: creator overlay part

* feat: overlay actually kind of works 🚀

* WIP: overlay working - not reopening

* fix: webview displays again 🚀

* fix: removing duplicate iframes

* fix: animations + waiting for webview loaded message to begin

* feat: added animation for creator mode button

* fix: theme shizz

* feat: added method to send theme colours to the webview

* fix: format of msg + sending over text colours

* fix: creator overlay syncs with the current theme better

* chore: format on save disabled

* fix: title bar colours

* feat: added progress to next stage method

* feat: added partial overlay shizz

* WIP: state management shizz

* chore: changed overlay_closed_creator_active options

* feat: added command to tell the submodule that the creator has closed

* fix: exit creator mode bug

* fix: creator-mode-button z-index increased to 999

* fix: overlay always comes up

* fix: disappearing bug

* fix: not setting shizz to full screen when we enter creator

* fix: restarting vscode exits creator view 😎

* chore: removed unused var

* chore: included npm run dev with roo code

* devops: end to the dev ex hell

* fix: script

* chore: removed pearai roo code + submodule submodules

* fix: overlay glitching looks *less bad*

* feat: added creator mode button

* fix: btn style

* win button (#269)

* fix: removed border radius

* chore: removed sparkle icon from creator mode

* fix: btn sizing

* chore: reverting windows btn fix - TMP

* feat: created handler for messages + feedback command

* fix: message handler

* chore: shifting to the left if on windows

* win fix

* mac fontsize

* mac fontsize

* Bumped to v2.0.0

* Remove console.dir

* Leave notifications

* Do not set node env in code.sh

---------

Co-authored-by: Acorn221 <james@arnott.tech>
Co-authored-by: James Arnott <james@rno.tt>
Co-authored-by: Himanshu <him.speedo@gmail.com>
2025-05-14 13:13:41 -04:00

193 lines
5.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
# ===========================================================================
# CONFIGURATION SECTION - Edit these variables to match your environment
# ===========================================================================
# Path to PearAI-Roo-Code extension
PEARAI_ROO_CODE_PATH="./../PearAI-Roo-Code"
# Path to pearai-submodule vscode extension
PEARAI_SUBMODULE_PATH="./../pearai-submodule/extensions/vscode"
# Enable/disable building pearai submodule before launch (uncomment to enable)
# BUILD_PEARAI_SUBMODULE=true
# ===========================================================================
# END CONFIGURATION SECTION
# ===========================================================================
# Build pearai submodule if enabled
if [[ -n "$BUILD_PEARAI_SUBMODULE" ]]; then
cd extensions/pearai-submodule
./scripts/install-and-build.sh
cd ../..
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
ROOT=$(dirname "$(dirname "$(realpath "$0")")")
else
ROOT=$(dirname "$(dirname "$(readlink -f $0)")")
# If the script is running in Docker using the WSL2 engine, powershell.exe won't exist
if grep -qi Microsoft /proc/version && type powershell.exe > /dev/null 2>&1; then
IN_WSL=true
fi
fi
# Default paths for extension development - using relative paths from ROOT
EXTENSION_PATHS=(
"${ROOT}/extensions/vscode"
)
# Add PearAI extensions
if [[ -d "${ROOT}/${PEARAI_ROO_CODE_PATH}" ]]; then
EXTENSION_PATHS+=("${ROOT}/${PEARAI_ROO_CODE_PATH}")
else
echo "Warning: PearAI-Roo-Code extension path not found at ${ROOT}/${PEARAI_ROO_CODE_PATH}"
fi
if [[ -d "${ROOT}/${PEARAI_SUBMODULE_PATH}" ]]; then
EXTENSION_PATHS+=("${ROOT}/${PEARAI_SUBMODULE_PATH}")
else
echo "Warning: PearAI submodule vscode extension path not found at ${ROOT}/${PEARAI_SUBMODULE_PATH}"
fi
# Function to check if directory exists and add to extension paths
add_extension_path() {
if [ -d "$1" ]; then
EXTENSION_PATHS+=("$1")
else
echo "Warning: Extension path $1 does not exist, skipping..."
fi
}
# Process command line arguments for extension paths
process_args() {
local i=1
while [ $i -le $# ]; do
arg="${!i}"
if [[ "$arg" == "--ext-path="* ]]; then
path="${arg#*=}"
add_extension_path "$path"
elif [[ "$arg" == "--ext-path" && $(($i + 1)) -le $# ]]; then
j=$(($i + 1))
path="${!j}"
add_extension_path "$path"
((i++))
fi
((i++))
done
}
function code() {
cd "$ROOT"
if [[ "$OSTYPE" == "darwin"* ]]; then
NAME=$(node -p "require('./product.json').nameLong")
CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron"
else
NAME=$(node -p "require('./product.json').applicationName")
CODE=".build/electron/$NAME"
fi
# Get electron, compile, built-in extensions
if [[ -z "${VSCODE_SKIP_PRELAUNCH}" ]]; then
node build/lib/preLaunch.js
fi
# Manage built-in extensions
if [[ "$1" == "--builtin" ]]; then
exec "$CODE" build/builtin
return
fi
# Configuration
# export NODE_ENV="development"
export VSCODE_DEV=1
export VSCODE_CLI=1
export ELECTRON_ENABLE_STACK_DUMPING=1
export ELECTRON_ENABLE_LOGGING=1
DISABLE_TEST_EXTENSION="--disable-extension=vscode.vscode-api-tests"
if [[ "$@" == *"--extensionTestsPath"* ]]; then
DISABLE_TEST_EXTENSION=""
fi
# Process extension paths from command line
process_args "$@"
# Define sandbox test path
SANDBOX_TEST_PATH="${ROOT}/extensions/vscode/manual-testing-sandbox/test.js"
# Check if sandbox test file exists
if [[ -f "$SANDBOX_TEST_PATH" ]]; then
SANDBOX_ARG="$SANDBOX_TEST_PATH"
else
SANDBOX_ARG=""
fi
# Prepare extension development path arguments
EXT_DEV_ARGS=""
for path in "${EXTENSION_PATHS[@]}"; do
EXT_DEV_ARGS="$EXT_DEV_ARGS --extensionDevelopmentPath=$path"
done
# Show which extensions are being loaded
echo "Loading extensions from:"
for path in "${EXTENSION_PATHS[@]}"; do
echo " - $path"
done
# Launch Code with extension paths
if [[ -n "$SANDBOX_ARG" ]]; then
echo "Using sandbox test file: $SANDBOX_ARG"
exec "$CODE" . "$SANDBOX_ARG" $DISABLE_TEST_EXTENSION $EXT_DEV_ARGS "$@"
else
exec "$CODE" . $DISABLE_TEST_EXTENSION $EXT_DEV_ARGS "$@"
fi
}
function code-wsl()
{
HOST_IP=$(echo "" | powershell.exe -noprofile -Command "& {(Get-NetIPAddress | Where-Object {\$_.InterfaceAlias -like '*WSL*' -and \$_.AddressFamily -eq 'IPv4'}).IPAddress | Write-Host -NoNewline}")
export DISPLAY="$HOST_IP:0"
# in a wsl shell
ELECTRON="$ROOT/.build/electron/$NAME.exe"
if [ -f "$ELECTRON" ]; then
local CWD=$(pwd)
cd $ROOT
export WSLENV=ELECTRON_RUN_AS_NODE/w:VSCODE_DEV/w:$WSLENV
local WSL_EXT_ID="ms-vscode-remote.remote-wsl"
local WSL_EXT_WLOC=$(echo "" | VSCODE_DEV=1 ELECTRON_RUN_AS_NODE=1 "$ROOT/.build/electron/$NAME.exe" "out/cli.js" --locate-extension $WSL_EXT_ID)
cd $CWD
if [ -n "$WSL_EXT_WLOC" ]; then
# replace \r\n with \n in WSL_EXT_WLOC
local WSL_CODE=$(wslpath -u "${WSL_EXT_WLOC%%[[:cntrl:]]}")/scripts/wslCode-dev.sh
$WSL_CODE "$ROOT" "$@"
exit $?
else
echo "Remote WSL not installed, trying to run VSCode in WSL."
fi
fi
}
if [ "$IN_WSL" == "true" ] && [ -z "$DISPLAY" ]; then
code-wsl "$@"
elif [ -f /mnt/wslg/versions.txt ]; then
code --disable-gpu "$@"
elif [ -f /.dockerenv ]; then
# Workaround for https://bugs.chromium.org/p/chromium/issues/detail?id=1263267
# Chromium does not release shared memory when streaming scripts
# which might exhaust the available resources in the container environment
# leading to failed script loading.
code --disable-dev-shm-usage "$@"
else
code "$@"
fi
exit $?