dev.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. # Development script for llama.cpp webui
  3. #
  4. # This script starts the webui development servers (Storybook and Vite).
  5. # Note: You need to start llama-server separately.
  6. #
  7. # Usage:
  8. # bash scripts/dev.sh
  9. # npm run dev
  10. cd ../../../
  11. # Check and install git hooks if missing
  12. check_and_install_hooks() {
  13. local hooks_missing=false
  14. # Check for required hooks
  15. if [ ! -f ".git/hooks/pre-commit" ] || [ ! -f ".git/hooks/pre-push" ] || [ ! -f ".git/hooks/post-push" ]; then
  16. hooks_missing=true
  17. fi
  18. if [ "$hooks_missing" = true ]; then
  19. echo "🔧 Git hooks missing, installing them..."
  20. cd tools/server/webui
  21. if bash scripts/install-git-hooks.sh; then
  22. echo "✅ Git hooks installed successfully"
  23. else
  24. echo "⚠️ Failed to install git hooks, continuing anyway..."
  25. fi
  26. cd ../../../
  27. else
  28. echo "✅ Git hooks already installed"
  29. fi
  30. }
  31. # Install git hooks if needed
  32. check_and_install_hooks
  33. # Cleanup function
  34. cleanup() {
  35. echo "🧹 Cleaning up..."
  36. exit
  37. }
  38. # Set up signal handlers
  39. trap cleanup SIGINT SIGTERM
  40. echo "🚀 Starting development servers..."
  41. echo "📝 Note: Make sure to start llama-server separately if needed"
  42. cd tools/server/webui
  43. storybook dev -p 6006 --ci & vite dev --host 0.0.0.0 &
  44. # Wait for all background processes
  45. wait