runclinecore.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/env bash
  2. set -eu #x
  3. # This installs the cline-core app to the user's home directory,
  4. # and starts the service.
  5. if [[ "${1:-}" == "-h" ]]; then
  6. ./scripts/test-hostbridge-server.ts &
  7. fi
  8. CORE_DIR=~/.cline/core
  9. INSTALL_DIR=$CORE_DIR/dev-instance/
  10. LOG_FILE=~/.cline/cline-core-service.log
  11. ZIP_FILE=standalone.zip
  12. ZIP=dist-standalone/${ZIP_FILE}
  13. # Remove old unpacked versions to force reinstall
  14. rm -rf $CORE_DIR/* || true
  15. mkdir -p $INSTALL_DIR
  16. cp $ZIP $INSTALL_DIR
  17. cd $INSTALL_DIR
  18. unp $ZIP_FILE > /dev/null
  19. pkill -f cline-core.js || true
  20. # Detect platform name using the same logic as ClineDirs.kt in the plugin.
  21. OS=$(uname -s | tr '[:upper:]' '[:lower:]')
  22. ARCH=$(uname -m)
  23. if [[ "$OS" == "darwin" && "$ARCH" == "x86_64" ]]; then
  24. PLATFORM_NAME="darwin-x64"
  25. elif [[ "$OS" == "darwin" && "$ARCH" == "arm64" ]]; then
  26. PLATFORM_NAME="darwin-arm64"
  27. elif [[ "$OS" == *"mingw"* || "$OS" == *"cygwin"* || "$OS" == *"msys"* ]] && [[ "$ARCH" == "x86_64" || "$ARCH" == "amd64" ]]; then
  28. # Note: This script requires a bash-compatible environment on Windows (Git Bash, MSYS2, Cygwin)
  29. PLATFORM_NAME="win-x64"
  30. elif [[ "$OS" == "linux" && ("$ARCH" == "x86_64" || "$ARCH" == "amd64") ]]; then
  31. PLATFORM_NAME="linux-x64"
  32. else
  33. echo "Unsupported platform: $OS $ARCH"
  34. exit 1
  35. fi
  36. BINARY_MODULES_DIR="./binaries/$PLATFORM_NAME/node_modules"
  37. echo pwd: $(pwd)
  38. set -x
  39. NODE_PATH=$BINARY_MODULES_DIR:./node_modules DEV_WORKSPACE_FOLDER=/tmp/ node cline-core.js 2>&1 | tee $LOG_FILE