diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..e43b0f9889 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/.macos b/.macos new file mode 100755 index 0000000000..f0c4e09ce2 --- /dev/null +++ b/.macos @@ -0,0 +1,9 @@ +#reload source ~/.zshrc + + +############################################################################### +# Finder # +############################################################################### + +# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons +defaults write com.apple.finder QuitMenuItem -bool true diff --git a/README-dev.md b/README-dev.md new file mode 100644 index 0000000000..886a809d75 --- /dev/null +++ b/README-dev.md @@ -0,0 +1,182 @@ +# Rails + npm Development Setup + +This setup provides a comprehensive development environment for Rails apps with React/Redux frontend using Webpacker. + +## Files Created + +- `dev.sh` - Main development script with process management +- Updated `aliases` - Shell aliases for quick access + +## Installation + +1. **Make the script executable** (already done): + ```bash + chmod +x dev.sh + ``` + +2. **Reload your shell configuration**: + ```bash + source ~/.zshrc + # or if you source aliases separately: + source ~/path/to/aliases + ``` + +3. **Configure your package.json** (if not already done): + ```json + { + "scripts": { + "build": "webpack --mode production", + "watch": "webpack --watch --mode development", + "dev": "webpack-dev-server --mode development" + } + } + ``` + +## Usage + +### Basic Commands + +```bash +# Start Rails server only +dev-rails + +# Start npm watch only +dev-npm + +# Start both Rails server and npm watch +dev-both + +# Run npm build +dev-build + +# Check status +dev-status + +# Stop all processes +dev-stop +``` + +### Quick Shortcuts + +```bash +dev # Start both (same as dev-both) +devs # Show status +devk # Kill all processes +``` + +### Enhanced Rails Server Aliases + +```bash +s3dev # Rails server on port 3000 with process management +s4dev # Rails server on port 4000 with process management +s5dev # Rails server on port 5000 with process management +``` + +### Enhanced npm Aliases + +```bash +npm-dev # Start npm watch +npm-build # Run npm build +npm-watch # Start npm watch +``` + +### Advanced Usage + +```bash +# Start Rails on custom port +RAILS_PORT=4000 dev-rails + +# Use custom npm script names +NPM_WATCH_SCRIPT=dev NPM_BUILD_SCRIPT=build-prod dev-npm + +# Direct script usage +./dev.sh rails +./dev.sh both +./dev.sh status +``` + +## Features + +### Process Management +- **PID tracking**: Each process is tracked with PID files +- **Graceful shutdown**: Processes are properly terminated on script exit +- **Status checking**: Verify if processes are actually running +- **Duplicate prevention**: Won't start multiple instances + +### Error Handling +- **Dependency checking**: Verifies Rails and npm are installed +- **File validation**: Checks for `package.json` existence +- **Process validation**: Confirms processes started successfully +- **Exit codes**: Proper error codes for automation + +### Logging +- **Separate log files**: Rails and npm logs are saved separately +- **Color-coded output**: Easy to distinguish different message types +- **Status messages**: Clear feedback on what's happening + +### Environment Variables +- `RAILS_PORT` - Rails server port (default: 3000) +- `NPM_WATCH_SCRIPT` - npm watch script name (default: watch) +- `NPM_BUILD_SCRIPT` - npm build script name (default: build) + +## Integration with Existing Aliases + +This setup integrates seamlessly with your existing aliases: +- Your existing Rails server aliases (`s3`, `s4`, etc.) still work +- New development aliases provide enhanced process management +- All existing git and other aliases remain unchanged + +## Troubleshooting + +### Common Issues + +1. **"Rails command not found"** + - Make sure Rails is installed: `gem install rails` + +2. **"npm command not found"** + - Make sure Node.js is installed: `brew install node` + +3. **"package.json not found"** + - Make sure you're in the correct directory (Rails project root) + +4. **Process won't start** + - Check logs: `tail -f /tmp/rails.log` or `tail -f /tmp/npm.log` + - Kill existing processes: `dev-stop` + +### Log Files + +- Rails logs: `/tmp/rails.log` +- npm logs: `/tmp/npm.log` +- PID files: `/tmp/dev-scripts/` + +## Examples + +### Typical Development Workflow + +```bash +# Start development environment +dev + +# Check status +devs + +# Stop everything when done +devk +``` + +### Custom Configuration + +```bash +# Start Rails on port 4000 and npm with custom script +RAILS_PORT=4000 NPM_WATCH_SCRIPT=dev dev-both +``` + +### Integration with Existing Workflow + +```bash +# Your existing aliases still work +s3 # rails s (port 3000) + +# New enhanced aliases +s3dev # Rails with process management +``` \ No newline at end of file diff --git a/README.md b/README.md index 3c08d57c25..e8ae206cb2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ This repository is used by [Le Wagon](https://www.lewagon.com) students. +Advanced setup: see Rails + npm workflow in [README-dev.md](README-dev.md). + ## Toolset - [oh-my-zsh](http://ohmyz.sh/) - [Visual Studio Code](https://code.visualstudio.com/) - [git](https://git-scm.com/) + diff --git a/aliases b/aliases index 275ac0447d..9c2278a607 100644 --- a/aliases +++ b/aliases @@ -1,9 +1,295 @@ -# Get External IP / Internet Speed -alias myip="curl https://ipinfo.io/json" # or /ip for plain-text ip -alias speedtest="curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -" +# ---- +# Custom aliases +# Rails + npm workflow: see ./dev.sh and README-dev.md for full docs +# Key commands: dev (both), devs (status), devk (stop) +# ---- +# +# Get External IP / local IPs +alias ip="curl ipinfo.io/ip" +alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'" +alias speedtest="wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test10.zip" + + + + + +#Python + # Quickly serve the current directory as HTTP -alias serve='ruby -run -e httpd . -p 8000' # Or python -m SimpleHTTPServer :) +alias serve='ruby -run -e httpd . -p 8000' # Or python -m SimpleHTTPServer :) + +#pyton vitual env activated Le Wagon +alias penv='pyenv activate lewagon' + +#open jupyter notebook +alias jnote='jupyter notebook' + + +#kill port processes +alias kp='npx kill-port' # + +#List running server +alias wsr='lsof -nP +c 15 | grep LISTEN' + +# AI Factory Docker Compose alias +# Usage: dl up, dl down, dl ps, dl logs, etc. +alias dl='/Users/ces/code/AzCez/dotfiles/scripts/ai_factory/dl' + +# Server port 3000 +alias s3='rails s' + +# Server port 4000 +alias s4='rails s -p 4000' + +# Server port 5000 +alias s5='rails s -p 5000' + +# Server port 6000 +alias s6='rails s -p 6000' s + +# Server port 7000 +alias s7='rails s -p 7000' + +# Server port 8000 +alias s8='rails s -p 8000' + + +# Rails + npm Development Aliases +# Make sure dev.sh is executable: chmod +x dev.sh + +# Development script aliases +alias dev-rails='./dev.sh rails' +alias dev-npm='./dev.sh npm' +alias dev-both='./dev.sh both' +alias dev-build='./dev.sh build' +alias dev-watch='./dev.sh watch' +alias dev-stop='./dev.sh stop' +alias dev-status='./dev.sh status' + +# Quick development shortcuts +alias dev='./dev.sh both' # Start both Rails and npm watch +alias devs='./dev.sh status' # Show status +alias devk='./dev.sh stop' # Kill all processes + +# Enhanced Rails server aliases (building on your existing ones) +alias s3dev='RAILS_PORT=3000 ./dev.sh rails' +alias s4dev='RAILS_PORT=4000 ./dev.sh rails' +alias s5dev='RAILS_PORT=5000 ./dev.sh rails' + +# Enhanced npm aliases +alias npm-dev='./dev.sh npm' +alias npm-build='./dev.sh build' +alias npm-watch='./dev.sh watch' + + +# Webpack compile +alias wpc='webpack-dev-server' + +#open ngrok +Alias ngrok='./ngrok' + +# Rails/Vite server management (moved from zshrc to keep upstream zshrc clean) +# Note: we keep existing `rds` for rails db:seed; do not reuse that name here. +alias krs="echo 'Killing Rails server...' && pkill -f 'rails server' 2>/dev/null && echo '✅ Rails server killed' || echo 'ℹ️ Rails server not running'" +alias kvs="echo 'Killing Vite server on port 3036...' && (lsof -ti:3036 | xargs kill -9 2>/dev/null || true); pkill -f 'vite' 2>/dev/null; pkill -f 'npm exec vite' 2>/dev/null; echo '✅ Vite server killed'" +alias crs="echo '=== SERVER STATUS CHECK ==='; echo; if lsof -i :3000 >/dev/null 2>&1; then echo '✅ Rails (3000): running (PID '$(lsof -ti :3000 | head -1)')'; else echo '❌ Rails (3000): not running'; fi; echo; if lsof -i :3036 >/dev/null 2>&1; then echo '✅ Vite (3036): running (PID '$(lsof -ti :3036 | head -1)')'; else echo '❌ Vite (3036): not running'; fi; echo; echo 'URLs:'; echo ' Rails: http://localhost:3000'; echo ' Vite: http://localhost:3036'" +alias rvs="npx vite --port 3037" + +# Ruby + +alias ru='ruby cd \"${fileDirname}\"\u000D' + + +# RoR + + + +# rails db:drop +alias rdd='rails db:drop' + +# rails db:create +alias rdc='rails db:create' + +# rails db:migrate +alias rdm='rails db:migrate' + +# rails db:seed +# alias rds='rails db:seed' + + +# rails db:seed db:create db:migrate +alias rdb='rdd rdc rdm' + + +#Push your code to Heroku +alias gph='git push heroku master' + +alias hpass='git push chateaupass master' +alias hdm='heroku run rails db:migrate --app chateaupass' +alias hrc='heroku run rails c --app chateaupass' +alias hlogs='heroku logs --tail --app chateaupass' + + +# GIT + +# remove .git +alias rmgit='rm -rf .git' + +#git create repo + ignore DS_Store +alias repo='git init; hub create -p; find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch;echo .DS_Store >> .gitignore;git add .gitignore;git commit -m ".DS_Store banished!";git push origin master; ga; comthis "first push on repo"; gor' + +#git generic commit +alias nocom='ga;comthis "generic commit either for test purpose or just lasy...";gor' + +#git ignore DS_Store +alias ds=' find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch;echo .DS_Store >> .gitignore;git add .gitignore;git commit -m ".DS_Store banished!";git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)' + + +# one-line git log with 24h date+time +alias lo="git log --abbrev-commit --pretty=format:'%h %ad %s' --date=format-local:'%Y-%m-%d %H:%M'" + + +#git remote remove origin +alias grr='git remote remove origin' + +#git log --oneline +#alias com='git log --oneline' +#or +alias com='git lg' + +# git fetch +alias gf='git fetch' + +# git pull +alias gp='git pull' + +# git fetch then pull +alias gfp='gf; gp' + +# git add . +alias ga='git add .' + +#git commit -m .... +alias comthis='git commit -m' + +#Git add/status/commit with question prompt in terminal +function gcom() { + git add . + gst + read REPLY\?"Type commit => " + print "" + print ">> commit is: \"${REPLY}\"" + print "" + git commit -m "${REPLY}" + } + +#Git add/status/commit/push with question prompt in terminal +function cg() { + git add . + gst + read REPLY\?"Type commit => " + print "" + print ">> commit is: \"${REPLY}\"" + print "" + git commit -m "${REPLY}" + git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD) + print "" + print ">> Git STATUS after commit and push origin:" + print "" + gst + } + +# git status then git add . then git status +function gsa() { + gst + ga + gst +} + + +#git checkout master +alias gcm='git checkout main' + +#git checkout branch +alias gcb='git checkout' + +# git push origin +alias gpo='git push origin' + +#git push origin .... +alias gor='git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)' + +#reset git ignore + +alias resig='git rm -r --cached .; git add .; git commit -m "fixed untracked files"; gst' + + +#LOCAL +# 11. Reload shortcut +alias reload='source ~/.zshrc' # one-word command to re-source your config + +# Show alias file content in terminal +alias al='cat /Users/ces/code/AzCez/dotfiles/aliases' + +# Open your dotfiles in VS Code with: +alias dotfiles='code /Users/ces/code/AzCez/dotfiles' + +# open in visual studio +alias vsc='open . -a "Visual Studio Code"' + +# go to Local to CODE folder +alias codef='cd /Users/ces/code' + + +# go to code folder in cloud +alias icloud='cd /Users/ces/Library/Mobile\ Documents/com~apple~CloudDocs' + +# go to mobeetravel folder in cloud +alias mt='cd /Users/ces/Library/Mobile\ Documents/com~apple~CloudDocs/code/Mobeetravel' + +# 1. Open files or folders in the Cursor IDE +# c() { open -a "Cursor" "$@"; } # defines `c` to launch the Cursor app with given file/dir + +#ZSH test + +function vnc() { + open vnc://"$USER"@"$1" +} + function question() { + git add . + gst + read REPLY\?"Type commit =>" + print "" + print ">> commit is: ${REPLY}" + print "" + git commit -m "${REPLY}" + } + + + + + + + + +#ZSH Interpolation +#TMP=" hello ${:-=cat}" +#$ TMP="${:-=cat}" +#$ print -rl -- $TMP +#=>cat +# question code snippet : #read -q "REPLY?Enter COMMIT?" + +# Development Server Aliases +alias rds="$HOME/code/AzCez/dotfiles/scripts/rds.sh" # Start both Rails and Vite servers +alias crs="$HOME/code/AzCez/dotfiles/scripts/crs.sh" # Check server status +alias krs="$HOME/code/AzCez/dotfiles/scripts/krs.sh" # Kill Rails server only +alias kvs="$HOME/code/AzCez/dotfiles/scripts/kvs.sh" # Kill Vite server only +alias rvs="$HOME/code/AzCez/dotfiles/scripts/rvs.sh" # Start just Vite server +alias kas="$HOME/code/AzCez/dotfiles/scripts/kas.sh" # Kill all servers -# NOTE: On Q3 2021, Le Wagon decided to change the Web Dev curriculum default text editor -alias stt="echo 'Launching VS Code instead of Sublime Text... (cf ~/.aliases)' && code ." +# Log tail aliases +alias trs='tail -f /tmp/rails.log' # Rails server logs +alias tvs='tail -f /tmp/vite.log' # Vite server logs +alias trdsdok='docker logs -f' # Redis (Docker) logs (usage: trdsdok ) +alias tsk='tail -f log/sidekiq.log' # Sidekiq logs diff --git a/aliases.backup b/aliases.backup new file mode 100644 index 0000000000..ea6cdcc5d5 --- /dev/null +++ b/aliases.backup @@ -0,0 +1,285 @@ +# ---- +# Custom aliases +# Rails + npm workflow: see ./dev.sh and README-dev.md for full docs +# Key commands: dev (both), devs (status), devk (stop) +# ---- +# +# Get External IP / local IPs +alias ip="curl ipinfo.io/ip" +alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'" +alias speedtest="wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test10.zip" + + + + + +#Python + + +# Quickly serve the current directory as HTTP +alias serve='ruby -run -e httpd . -p 8000' # Or python -m SimpleHTTPServer :) + +#pyton vitual env activated Le Wagon +alias penv='pyenv activate lewagon' + +#open jupyter notebook +alias jnote='jupyter notebook' + + +#kill port processes +alias kp='npx kill-port' # + +#List running server +alias wsr='lsof -nP +c 15 | grep LISTEN' + +# Server port 3000 +alias s3='rails s' + +# Server port 4000 +alias s4='rails s -p 4000' + +# Server port 5000 +alias s5='rails s -p 5000' + +# Server port 6000 +alias s6='rails s -p 6000' s + +# Server port 7000 +alias s7='rails s -p 7000' + +# Server port 8000 +alias s8='rails s -p 8000' + + +# Rails + npm Development Aliases +# Make sure dev.sh is executable: chmod +x dev.sh + +# Development script aliases +alias dev-rails='./dev.sh rails' +alias dev-npm='./dev.sh npm' +alias dev-both='./dev.sh both' +alias dev-build='./dev.sh build' +alias dev-watch='./dev.sh watch' +alias dev-stop='./dev.sh stop' +alias dev-status='./dev.sh status' + +# Quick development shortcuts +alias dev='./dev.sh both' # Start both Rails and npm watch +alias devs='./dev.sh status' # Show status +alias devk='./dev.sh stop' # Kill all processes + +# Enhanced Rails server aliases (building on your existing ones) +alias s3dev='RAILS_PORT=3000 ./dev.sh rails' +alias s4dev='RAILS_PORT=4000 ./dev.sh rails' +alias s5dev='RAILS_PORT=5000 ./dev.sh rails' + +# Enhanced npm aliases +alias npm-dev='./dev.sh npm' +alias npm-build='./dev.sh build' +alias npm-watch='./dev.sh watch' + + +# Webpack compile +alias wpc='webpack-dev-server' + +#open ngrok +Alias ngrok='./ngrok' + +# Rails/Vite server management (moved from zshrc to keep upstream zshrc clean) +# Note: we keep existing `rds` for rails db:seed; do not reuse that name here. +alias krs="echo 'Killing Rails server...' && pkill -f 'rails server' 2>/dev/null && echo '✅ Rails server killed' || echo 'ℹ️ Rails server not running'" +alias kvs="echo 'Killing Vite server on port 3036...' && (lsof -ti:3036 | xargs kill -9 2>/dev/null || true); pkill -f 'vite' 2>/dev/null; pkill -f 'npm exec vite' 2>/dev/null; echo '✅ Vite server killed'" +alias crs="echo '=== SERVER STATUS CHECK ==='; echo; if lsof -i :3000 >/dev/null 2>&1; then echo '✅ Rails (3000): running (PID '$(lsof -ti :3000 | head -1)')'; else echo '❌ Rails (3000): not running'; fi; echo; if lsof -i :3036 >/dev/null 2>&1; then echo '✅ Vite (3036): running (PID '$(lsof -ti :3036 | head -1)')'; else echo '❌ Vite (3036): not running'; fi; echo; echo 'URLs:'; echo ' Rails: http://localhost:3000'; echo ' Vite: http://localhost:3036'" +alias rvs="npx vite --port 3037" + +# Ruby + +alias ru='ruby cd \"${fileDirname}\"\u000D' + + +# RoR + + + +# rails db:drop +alias rdd='rails db:drop' + +# rails db:create +alias rdc='rails db:create' + +# rails db:migrate +alias rdm='rails db:migrate' + +# rails db:seed +# alias rds='rails db:seed' + + +# rails db:seed db:create db:migrate +alias rdb='rdd rdc rdm' + + +#Push your code to Heroku +alias gph='git push heroku master' + +alias hpass='git push chateaupass master' +alias hdm='heroku run rails db:migrate --app chateaupass' +alias hrc='heroku run rails c --app chateaupass' +alias hlogs='heroku logs --tail --app chateaupass' + + +# GIT + +# remove .git +alias rmgit='rm -rf .git' + +#git create repo + ignore DS_Store +alias repo='git init; hub create -p; find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch;echo .DS_Store >> .gitignore;git add .gitignore;git commit -m ".DS_Store banished!";git push origin master; ga; comthis "first push on repo"; gor' + +#git generic commit +alias nocom='ga;comthis "generic commit either for test purpose or just lasy...";gor' + +#git ignore DS_Store +alias ds=' find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch;echo .DS_Store >> .gitignore;git add .gitignore;git commit -m ".DS_Store banished!";git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)' + + +# one-line git log with 24h date+time +alias lo="git log --abbrev-commit --pretty=format:'%h %ad %s' --date=format-local:'%Y-%m-%d %H:%M'" + + +#git remote remove origin +alias grr='git remote remove origin' + +#git log --oneline +#alias com='git log --oneline' +#or +alias com='git lg' + +# git fetch +alias gf='git fetch' + +# git pull +alias gp='git pull' + +# git fetch then pull +alias gfp='gf; gp' + +# git add . +alias ga='git add .' + +#git commit -m .... +alias comthis='git commit -m' + +#Git add/status/commit with question prompt in terminal +function gcom() { + git add . + gst + read REPLY\?"Type commit => " + print "" + print ">> commit is: \"${REPLY}\"" + print "" + git commit -m "${REPLY}" + } + +#Git add/status/commit/push with question prompt in terminal +function cg() { + git add . + gst + read REPLY\?"Type commit => " + print "" + print ">> commit is: \"${REPLY}\"" + print "" + git commit -m "${REPLY}" + git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD) + print "" + print ">> Git STATUS after commit and push origin:" + print "" + gst + } + +# git status then git add . then git status +function gsa() { + gst + ga + gst +} + + +#git checkout master +alias gcm='git checkout main' + +#git checkout branch +alias gcb='git checkout' + +# git push origin +alias gpo='git push origin' + +#git push origin .... +alias gor='git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)' + +#reset git ignore + +alias resig='git rm -r --cached .; git add .; git commit -m "fixed untracked files"; gst' + + +#LOCAL +# 11. Reload shortcut +alias reload='source ~/.zshrc' # one-word command to re-source your config + +# Show alias file content in terminal +alias al='cat /Users/ces/code/AzCez/dotfiles/aliases' + +# Open your dotfiles in VS Code with: +alias dotfiles='code /Users/ces/code/AzCez/dotfiles' + +# open in visual studio +alias vsc='open . -a "Visual Studio Code"' + +# go to Local to CODE folder +alias codef='cd /Users/ces/code' + + +# go to code folder in cloud +alias icloud='cd /Users/ces/Library/Mobile\ Documents/com~apple~CloudDocs' + +# go to mobeetravel folder in cloud +alias mt='cd /Users/ces/Library/Mobile\ Documents/com~apple~CloudDocs/code/Mobeetravel' + +# 1. Open files or folders in the Cursor IDE +# c() { open -a "Cursor" "$@"; } # defines `c` to launch the Cursor app with given file/dir + +#ZSH test + +function vnc() { + open vnc://"$USER"@"$1" +} + function question() { + git add . + gst + read REPLY\?"Type commit =>" + print "" + print ">> commit is: ${REPLY}" + print "" + git commit -m "${REPLY}" + } + + + + + + + + +#ZSH Interpolation +#TMP=" hello ${:-=cat}" +#$ TMP="${:-=cat}" +#$ print -rl -- $TMP +#=>cat +# question code snippet : #read -q "REPLY?Enter COMMIT?" + +# Development Server Aliases +alias rds="$HOME/code/AzCez/dotfiles/scripts/rds.sh" # Start both Rails and Vite servers +alias crs="$HOME/code/AzCez/dotfiles/scripts/crs.sh" # Check server status +alias krs="echo "Killing Rails server on port 3000..." && lsof -ti:3000 | xargs kill -9 2>/dev/null; pkill -f "rails" 2>/dev/null; pkill -f "puma" 2>/dev/null; pkill -f "bundle exec rails" 2>/dev/null; echo "✅ Rails server killed"" # Kill Rails server only +alias kvs="echo "Killing Vite server on port 3036..." && lsof -ti:3036 | xargs kill -9 2>/dev/null; pkill -f "vite" 2>/dev/null; pkill -f "npm exec vite" 2>/dev/null; echo "✅ Vite server killed"" # Kill Vite server only +alias rvs="$HOME/code/AzCez/dotfiles/scripts/rvs.sh" # Start just Vite server +alias kas="$HOME/code/AzCez/dotfiles/scripts/kas.sh" # Kill all servers \ No newline at end of file diff --git a/dev.sh b/dev.sh new file mode 100755 index 0000000000..6497ddc0e0 --- /dev/null +++ b/dev.sh @@ -0,0 +1,249 @@ +#!/bin/bash + +# Rails + npm Development Script +# Usage: ./dev.sh [rails|npm|both|build|watch|stop|status] + +set -e # Exit on any error + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# Configuration +RAILS_PORT=${RAILS_PORT:-3000} +NPM_WATCH_SCRIPT=${NPM_WATCH_SCRIPT:-"watch"} +NPM_BUILD_SCRIPT=${NPM_BUILD_SCRIPT:-"build"} +PID_DIR="/tmp/dev-scripts" +RAILS_PID_FILE="$PID_DIR/rails.pid" +NPM_PID_FILE="$PID_DIR/npm.pid" + +# Create PID directory if it doesn't exist +mkdir -p "$PID_DIR" + +# Helper functions +log_info() { + echo -e "${BLUE}[INFO]${NC} $1" +} + +log_success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +log_warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +# Check if process is running +is_process_running() { + local pid_file=$1 + if [[ -f "$pid_file" ]]; then + local pid=$(cat "$pid_file") + if kill -0 "$pid" 2>/dev/null; then + return 0 + else + rm -f "$pid_file" + return 1 + fi + fi + return 1 +} + +# Kill process by PID file +kill_process() { + local pid_file=$1 + local process_name=$2 + + if is_process_running "$pid_file"; then + local pid=$(cat "$pid_file") + log_info "Stopping $process_name (PID: $pid)..." + kill "$pid" 2>/dev/null || true + rm -f "$pid_file" + log_success "$process_name stopped" + else + log_warning "$process_name is not running" + fi +} + +# Start Rails server +start_rails() { + if is_process_running "$RAILS_PID_FILE"; then + log_warning "Rails server is already running" + return 0 + fi + + log_info "Starting Rails server on port $RAILS_PORT..." + + # Check if Rails is available + if ! command -v rails &> /dev/null; then + log_error "Rails command not found. Make sure Rails is installed." + exit 1 + fi + + # Start Rails server in background + rails server -p "$RAILS_PORT" > /tmp/rails.log 2>&1 & + local rails_pid=$! + echo "$rails_pid" > "$RAILS_PID_FILE" + + # Wait a moment to check if it started successfully + sleep 2 + if kill -0 "$rails_pid" 2>/dev/null; then + log_success "Rails server started (PID: $rails_pid)" + log_info "Rails server logs: tail -f /tmp/rails.log" + else + log_error "Failed to start Rails server" + rm -f "$RAILS_PID_FILE" + exit 1 + fi +} + +# Start npm watch +start_npm_watch() { + if is_process_running "$NPM_PID_FILE"; then + log_warning "npm watch is already running" + return 0 + fi + + log_info "Starting npm watch..." + + # Check if package.json exists + if [[ ! -f "package.json" ]]; then + log_error "package.json not found. Make sure you're in the correct directory." + exit 1 + fi + + # Check if npm is available + if ! command -v npm &> /dev/null; then + log_error "npm command not found. Make sure Node.js is installed." + exit 1 + fi + + # Start npm watch in background + npm run "$NPM_WATCH_SCRIPT" > /tmp/npm.log 2>&1 & + local npm_pid=$! + echo "$npm_pid" > "$NPM_PID_FILE" + + # Wait a moment to check if it started successfully + sleep 2 + if kill -0 "$npm_pid" 2>/dev/null; then + log_success "npm watch started (PID: $npm_pid)" + log_info "npm watch logs: tail -f /tmp/npm.log" + else + log_error "Failed to start npm watch" + rm -f "$NPM_PID_FILE" + exit 1 + fi +} + +# Run npm build +run_npm_build() { + log_info "Running npm build..." + + if [[ ! -f "package.json" ]]; then + log_error "package.json not found. Make sure you're in the correct directory." + exit 1 + fi + + if ! command -v npm &> /dev/null; then + log_error "npm command not found. Make sure Node.js is installed." + exit 1 + fi + + if npm run "$NPM_BUILD_SCRIPT"; then + log_success "npm build completed successfully" + else + log_error "npm build failed" + exit 1 + fi +} + +# Show status +show_status() { + echo -e "${BLUE}=== Development Environment Status ===${NC}" + + if is_process_running "$RAILS_PID_FILE"; then + local rails_pid=$(cat "$RAILS_PID_FILE") + echo -e "${GREEN}✓ Rails server is running (PID: $rails_pid)${NC}" + else + echo -e "${RED}✗ Rails server is not running${NC}" + fi + + if is_process_running "$NPM_PID_FILE"; then + local npm_pid=$(cat "$NPM_PID_FILE") + echo -e "${GREEN}✓ npm watch is running (PID: $npm_pid)${NC}" + else + echo -e "${RED}✗ npm watch is not running${NC}" + fi + + echo -e "${BLUE}==========================================${NC}" +} + +# Cleanup function +cleanup() { + log_info "Cleaning up processes..." + kill_process "$RAILS_PID_FILE" "Rails server" + kill_process "$NPM_PID_FILE" "npm watch" +} + +# Trap to cleanup on script exit +trap cleanup EXIT + +# Main script logic +case "${1:-help}" in + "rails") + start_rails + ;; + "npm") + start_npm_watch + ;; + "both") + start_rails + start_npm_watch + log_success "Both Rails server and npm watch are running" + log_info "Press Ctrl+C to stop both processes" + wait + ;; + "build") + run_npm_build + ;; + "watch") + start_npm_watch + ;; + "stop") + cleanup + ;; + "status") + show_status + ;; + "help"|*) + echo -e "${BLUE}Rails + npm Development Script${NC}" + echo "" + echo "Usage: $0 [COMMAND]" + echo "" + echo "Commands:" + echo " rails - Start Rails server only" + echo " npm - Start npm watch only" + echo " both - Start both Rails server and npm watch" + echo " build - Run npm build" + echo " watch - Start npm watch (alias for npm)" + echo " stop - Stop all running processes" + echo " status - Show status of running processes" + echo " help - Show this help message" + echo "" + echo "Environment variables:" + echo " RAILS_PORT - Rails server port (default: 3000)" + echo " NPM_WATCH_SCRIPT - npm watch script name (default: watch)" + echo " NPM_BUILD_SCRIPT - npm build script name (default: build)" + echo "" + echo "Examples:" + echo " $0 rails # Start Rails server" + echo " $0 both # Start both Rails and npm watch" + echo " RAILS_PORT=4000 $0 rails # Start Rails on port 4000" + ;; +esac \ No newline at end of file diff --git a/gitconfig b/gitconfig index db3f5bd65d..197b92973b 100644 --- a/gitconfig +++ b/gitconfig @@ -44,6 +44,7 @@ # Removes a file from the index unstage = reset HEAD -- + open = !/Users/ces/.oh-my-zsh/custom/plugins/git-open/git-open [help] autocorrect = 1 @@ -59,3 +60,6 @@ [init] defaultBranch = master +[user] + name = AzCez + email = AzCez@users.noreply.github.com diff --git a/scripts/ai_factory/GALIAS_COMMANDS.md b/scripts/ai_factory/GALIAS_COMMANDS.md new file mode 100644 index 0000000000..c663b1a17e --- /dev/null +++ b/scripts/ai_factory/GALIAS_COMMANDS.md @@ -0,0 +1,212 @@ +# AI Factory - Docker Compose Commands (Galias) + +This file contains all the key commands for managing the AI Factory Docker Compose local deployment. + +## 🚀 **Docker Compose Management Commands** + +### **Basic Operations** +```bash +# Start all services (build and run in background) +./bin/dl up + +# Stop all services +./bin/dl down + +# Start existing services +./bin/dl start + +# Stop running services (keep containers) +./bin/dl stop +``` + +### **Monitoring & Debugging** +```bash +# Check service status +./bin/dl ps + +# View live logs (follow mode) +./bin/dl logs + +# View last 100 lines of logs +./bin/dl tail 100 + +# View last N lines of logs +./bin/dl tail [N] + +# View logs for specific service +./bin/dl logs web +./bin/dl logs worker +./bin/dl logs db +./bin/dl logs redis +``` + +### **Service Management** +```bash +# Execute commands in containers +./bin/dl exec web ./bin/rails console +./bin/dl exec web ./bin/rails db:migrate +./bin/dl exec web ./bin/rails db:seed + +# Scale worker services +./bin/dl scale 3 + +# Rebuild all images (no cache) +./bin/dl rebuild +``` + +## 🌐 **Application Access** + +### **Web Application** +- **Main App**: https://localhost +- **Health Check**: https://localhost/up +- **Google OAuth**: https://localhost/users/auth/google_oauth2 + +### **Database Access** +- **PostgreSQL**: localhost:5432 +- **Database**: aifactory_development +- **Username**: postgres +- **Password**: postgres + +### **Redis Access** +- **Redis**: localhost:6379 +- **Database**: 1 + +## 👤 **Authentication** + +### **Admin Account** +- **Email**: admin@example.com +- **Password**: changeme123 + +### **Test Client Accounts** (password: `password`) +- **Client 1**: client1_member1@example.com, client1_member2@example.com, client1_member3@example.com +- **Client 2**: client2_member1@example.com, client2_member2@example.com, client2_member3@example.com, client2_member4@example.com, client2_member5@example.com, client2_member6@example.com + +### **Google OAuth** +- Works with your Google account +- Redirect URI: https://localhost/users/auth/google_oauth2/callback + +## 🔧 **Development Commands** + +### **Database Operations** +```bash +# Run migrations +./bin/dl exec web ./bin/rails db:migrate + +# Seed database +./bin/dl exec web ./bin/rails db:seed + +# Open Rails console +./bin/dl exec web ./bin/rails console + +# Reset database +./bin/dl exec web ./bin/rails db:reset +``` + +### **Asset Management** +```bash +# Precompile assets +./bin/dl exec web ./bin/rails assets:precompile + +# Clear asset cache +./bin/dl exec web ./bin/rails assets:clobber +``` + +### **Background Jobs** +```bash +# Check Sidekiq status +./bin/dl exec web ./bin/rails runner "puts Sidekiq::Stats.new.inspect" + +# Clear all jobs +./bin/dl exec web ./bin/rails runner "Sidekiq::Queue.new.clear" +``` + +## 🐳 **Docker Commands** + +### **Container Management** +```bash +# List all containers +docker ps -a + +# Restart specific container +docker restart aifactory-web-1 + +# View container logs +docker logs aifactory-web-1 + +# Execute shell in container +docker exec -it aifactory-web-1 /bin/bash +``` + +### **Image Management** +```bash +# List images +docker images + +# Remove unused images +docker image prune + +# Remove all images +docker rmi $(docker images -q) +``` + +## 📁 **File Locations** + +### **Configuration Files** +- **Environment**: `.env.local` +- **Docker Compose**: `docker-compose.yml` +- **Override**: `docker-compose.override.yml` +- **Script**: `bin/dl` + +### **Logs** +- **Application**: `./bin/dl logs web` +- **Worker**: `./bin/dl logs worker` +- **Database**: `./bin/dl logs db` +- **Redis**: `./bin/dl logs redis` + +## 🚨 **Troubleshooting** + +### **Common Issues** +```bash +# Service not starting +./bin/dl ps +./bin/dl logs [service] + +# Port conflicts +./bin/dl down +docker system prune -f +./bin/dl up + +# Environment variables not loading +./bin/dl exec web env | grep GOOGLE + +# Database connection issues +./bin/dl exec web ./bin/rails db:migrate +``` + +### **Reset Everything** +```bash +# Stop and remove all containers +./bin/dl down + +# Remove all containers and networks +docker compose down --volumes --remove-orphans + +# Remove all images +docker rmi $(docker images -q) + +# Start fresh +./bin/dl up +``` + +## 📚 **Additional Resources** + +- **Main README**: [README.md](README.md) +- **Local Deployment**: [DEPLOY_LOCALLY.md](DEPLOY_LOCALLY.md) +- **Docker Compose Deploy**: [DOCKER_COMPOSE_DEPLOY.md](DOCKER_COMPOSE_DEPLOY.md) +- **Testing Guide**: [TESTING_README.md](TESTING_README.md) +- **Pipeline Graph Editor**: [PIPELINE_GRAPH_EDITOR_README.md](PIPELINE_GRAPH_EDITOR_README.md) +- **Nodes Documentation**: [NODES_README.md](NODES_README.md) +- **Controllers & Models**: [CONTROLLERS_MODELS_README.md](CONTROLLERS_MODELS_README.md) +- **LLM Management**: [LLM_MANAGEMENT_README.md](LLM_MANAGEMENT_README.md) +- **Policies**: [POLICIES_README.md](POLICIES_README.md) +- **UI/UX Design Guide**: [UI_UX_DESIGN_GUIDE.md](UI_UX_DESIGN_GUIDE.md) diff --git a/scripts/ai_factory/dl b/scripts/ai_factory/dl new file mode 100755 index 0000000000..191213a07d --- /dev/null +++ b/scripts/ai_factory/dl @@ -0,0 +1,19 @@ +#!/bin/bash + +# AI Factory Docker Compose wrapper script +# This script calls the actual ./bin/dl script from the AI Factory project directory + +AIFACTORY_PATH="/Users/ces/code/deepdocs_code/aifactory" + +if [ ! -d "$AIFACTORY_PATH" ]; then + echo "Error: AI Factory directory not found at $AIFACTORY_PATH" + exit 1 +fi + +if [ ! -f "$AIFACTORY_PATH/bin/dl" ]; then + echo "Error: ./bin/dl script not found in $AIFACTORY_PATH" + exit 1 +fi + +# Change to the AI Factory directory and run the dl script with all arguments +cd "$AIFACTORY_PATH" && ./bin/dl "$@" \ No newline at end of file diff --git a/scripts/crs.sh b/scripts/crs.sh new file mode 100755 index 0000000000..0c17c08c13 --- /dev/null +++ b/scripts/crs.sh @@ -0,0 +1,121 @@ +#!/bin/bash +echo "=== SERVER STATUS CHECK ===" +echo "" + +# Check Rails server +RAILS_RUNNING=false +if lsof -i :3000 >/dev/null 2>&1; then + PID=$(lsof -ti :3000 | head -1) + echo "✅ Rails server (port 3000): Running locally on IPv4 & IPv6 (localhost only). PID $PID." + RAILS_RUNNING=true +else + echo "❌ Rails server (port 3000): Not running" +fi + +echo "" + +# Check Vite server +VITE_RUNNING=false +if lsof -i :3036 >/dev/null 2>&1; then + PID=$(lsof -ti :3036 | head -1) + echo "✅ Vite dev server (port 3036): Running and listening on all interfaces (*). PID $PID." + VITE_RUNNING=true +else + echo "❌ Vite dev server (port 3036): Not running" +fi + +echo "" +# Check Redis server +REDIS_RUNNING=false +if lsof -i :6379 >/dev/null 2>&1; then + PID=$(lsof -ti :6379 | head -1) + echo "✅ Redis server (port 6379): Running. PID $PID." + REDIS_RUNNING=true +else + echo "❌ Redis server (port 6379): Not running" +fi + +echo "" +# Check Sidekiq workers +SIDEKIQ_RUNNING=false +SIDEKIQ_PID=$(ps aux | grep "[s]idekiq" | awk '{print $2}' | head -1) +if [ ! -z "$SIDEKIQ_PID" ]; then + echo "✅ Sidekiq workers: Running. Example PID $SIDEKIQ_PID." + SIDEKIQ_RUNNING=true +else + echo "❌ Sidekiq workers: Not running" +fi + +echo "" +echo "Related processes:" + +# Check for npm exec vite +NPM_PID=$(ps aux | grep "npm exec vite" | grep -v grep | awk '{print $2}' | head -1) +if [ ! -z "$NPM_PID" ]; then + echo " 📦 npm exec vite helper, PID $NPM_PID." +fi + +# Check for ruby_lsp_rails +RUBY_PID=$(ps aux | grep "ruby_lsp_rails" | grep -v grep | awk '{print $2}' | head -1) +if [ ! -z "$RUBY_PID" ]; then + echo " 🔧 ruby_lsp_rails language server, PID $RUBY_PID." +fi + +echo "" +# Docker status +if command -v docker >/dev/null 2>&1; then + if docker info >/dev/null 2>&1; then + echo "🐳 Docker daemon: Running" + RUNNING_CONTAINERS=$(docker ps --format '{{.Names}}' | wc -l | tr -d ' ') + if [ "$RUNNING_CONTAINERS" -gt 0 ]; then + echo " Containers running: $RUNNING_CONTAINERS" + DOCKER_REDIS=$(docker ps --filter "name=redis" --format '{{.Names}}' | paste -sd, -) + if [ ! -z "$DOCKER_REDIS" ]; then + echo " 🔴 redis containers: $DOCKER_REDIS" + fi + DOCKER_SIDEKIQ=$(docker ps --filter "name=sidekiq" --format '{{.Names}}' | paste -sd, -) + if [ ! -z "$DOCKER_SIDEKIQ" ]; then + echo " 🧰 sidekiq containers: $DOCKER_SIDEKIQ" + fi + else + echo " No containers running." + fi + else + echo "🐳 Docker daemon: Not running" + fi +else + echo "🐳 Docker: Not installed" +fi + +echo "" +echo "🌐 Access URLs:" +if [ "$RAILS_RUNNING" = true ]; then + echo " Rails: http://localhost:3000" +fi +if [ "$VITE_RUNNING" = true ]; then + echo " Vite: http://localhost:3036" +fi + +echo "" +echo "🔧 Management commands:" +echo " rds # Start both Rails and Vite servers" +echo " crs # Check server status (this command)" +echo " krs # Kill Rails server only" +echo " kvs # Kill Vite server only" +echo " rvs # Start just Vite server" +echo " kas # Kill all servers" + +echo "" +echo "📋 To view server logs:" +echo " tail -f /tmp/rails.log # Rails server (trs)" +echo " tail -f /tmp/vite.log # Vite server (tvs)" +echo " tail -f log/sidekiq.log # Sidekiq (Rails app) (tsk)" +echo " docker logs -f # Sidekiq (Docker) (tdok )" +if [ -f /opt/homebrew/var/log/redis.log ]; then + echo " tail -f /opt/homebrew/var/log/redis.log # Redis (Homebrew) (trds)" +elif [ -f /usr/local/var/log/redis.log ]; then + echo " tail -f /usr/local/var/log/redis.log # Redis (Homebrew) (trds)" +else + echo " redis-cli monitor # Redis live command stream (fallback)" +fi +echo " docker logs -f # Redis (Docker) (trdsdok )" diff --git a/scripts/kas.sh b/scripts/kas.sh new file mode 100755 index 0000000000..ff2f7c3df4 --- /dev/null +++ b/scripts/kas.sh @@ -0,0 +1,100 @@ +#!/bin/bash +echo "🛑 Killing all development servers..." +echo "" + +echo "Stopping Rails server (port 3000)..." +lsof -ti:3000 | xargs kill -9 2>/dev/null +pkill -f "rails" 2>/dev/null +pkill -f "puma" 2>/dev/null +pkill -f "bundle exec rails" 2>/dev/null + +echo "Stopping Vite server (ports 3036, 3106)..." +lsof -ti:3036 | xargs kill -9 2>/dev/null +lsof -ti:3106 | xargs kill -9 2>/dev/null +pkill -f "vite" 2>/dev/null +pkill -f "npm exec vite" 2>/dev/null +pkill -f "bundle exec vite" 2>/dev/null + +echo "Stopping Redis server (port 6379)..." +lsof -ti:6379 | xargs kill -9 2>/dev/null +pkill -f "redis-server" 2>/dev/null + +echo "Stopping GoodJob workers..." +pkill -f "good_job" 2>/dev/null +pkill -f "bundle exec good_job" 2>/dev/null + +echo "Stopping Python executors..." +echo " - Python executor (ports 8101, 8001)..." +# Python executor (ports 8101 and 8001 - default) +lsof -ti:8101 | xargs kill -9 2>/dev/null +lsof -ti:8001 | xargs kill -9 2>/dev/null +pkill -f "python_executor" 2>/dev/null +pkill -f "python_executor/dev_start" 2>/dev/null +pkill -f "uvicorn.*8101" 2>/dev/null +pkill -f "uvicorn.*8001" 2>/dev/null + +echo " - Python open executor (ports 8012, 8002)..." +# Python open executor (ports 8012 and 8002) +lsof -ti:8012 | xargs kill -9 2>/dev/null +lsof -ti:8002 | xargs kill -9 2>/dev/null +pkill -f "python_open_executor" 2>/dev/null +pkill -f "python_open_executor/dev_start" 2>/dev/null +pkill -f "uvicorn.*8012" 2>/dev/null +pkill -f "uvicorn.*8002" 2>/dev/null + +echo " - Python langchain executor (port 8110)..." +# Python langchain executor (port 8110) +lsof -ti:8110 | xargs kill -9 2>/dev/null +pkill -f "python_langchain_executor" 2>/dev/null +pkill -f "python_langchain_executor/dev_start" 2>/dev/null +pkill -f "run_uvicorn.sh" 2>/dev/null +pkill -f "uvicorn.*8110" 2>/dev/null + +echo " - API / uvicorn (port 8000)..." +lsof -ti:8000 | xargs kill -9 2>/dev/null +pkill -f "uvicorn.*8000" 2>/dev/null + +# Catch any remaining uvicorn processes running app.main:app +pkill -f "uvicorn app.main:app" 2>/dev/null + +echo "Stopping Foreman/Overmind processes..." +pkill -f "foreman" 2>/dev/null +pkill -f "overmind" 2>/dev/null +pkill -f "bin/dev" 2>/dev/null + +echo "Removing stale PID files..." +rm -f /Users/ces/code/deepdocs_code/aifactory/tmp/pids/server.pid 2>/dev/null +echo " ✓ Removed Rails server PID file" + +echo "Killing any remaining processes on development ports (3000, 3036, 3106, 6379, 8000, 8001, 8002, 8101, 8012, 8110)..." +# Kill any remaining processes on all development ports +REMAINING=$(lsof -ti:3000,3036,3106,6379,8000,8001,8002,8101,8012,8110 2>/dev/null | wc -l | tr -d ' ') +if [ "$REMAINING" -gt 0 ]; then + lsof -ti:3000,3036,3106,6379,8000,8001,8002,8101,8012,8110 2>/dev/null | xargs kill -9 2>/dev/null || true + echo " ✓ Killed $REMAINING remaining process(es)" +else + echo " ✓ No remaining processes found" +fi + +sleep 1 + +echo "" +echo "✅ All servers killed!" +echo "" +echo "📋 Summary:" +echo " • Rails server (port 3000)" +echo " • Vite server (ports 3036, 3106)" +echo " • Redis server (port 6379)" +echo " • GoodJob workers" +echo " • Python executors & API (ports 8000, 8001, 8002, 8101, 8012, 8110)" +echo " • Foreman/Overmind processes" +echo " • Stale PID files removed" +echo " • All remaining processes on development ports cleaned" +echo "" +echo "🔧 Management commands:" +echo " rds # Start both Rails and Vite servers" +echo " crs # Check server status" +echo " krs # Kill Rails server only" +echo " kvs # Kill Vite server only" +echo " rvs # Start just Vite server" +echo " kas # Kill all servers (Rails, Vite, GoodJob, Python executors, Redis)" diff --git a/scripts/krs.sh b/scripts/krs.sh new file mode 100755 index 0000000000..8358d55a61 --- /dev/null +++ b/scripts/krs.sh @@ -0,0 +1,18 @@ +#!/bin/bash +echo "🛑 Killing Rails server on port 3000..." +echo "" + +lsof -ti:3000 | xargs kill -9 2>/dev/null +pkill -f "rails" 2>/dev/null +pkill -f "puma" 2>/dev/null +pkill -f "bundle exec rails" 2>/dev/null + +echo "✅ Rails server killed!" +echo "" +echo "🔧 Management commands:" +echo " rds # Start both Rails and Vite servers" +echo " crs # Check server status" +echo " krs # Kill Rails server only (this command)" +echo " kvs # Kill Vite server only" +echo " rvs # Start just Vite server" +echo " kas # Kill all servers" diff --git a/scripts/kvs.sh b/scripts/kvs.sh new file mode 100755 index 0000000000..24b7c58d5e --- /dev/null +++ b/scripts/kvs.sh @@ -0,0 +1,17 @@ +#!/bin/bash +echo "🛑 Killing Vite server on port 3036..." +echo "" + +lsof -ti:3036 | xargs kill -9 2>/dev/null +pkill -f "vite" 2>/dev/null +pkill -f "npm exec vite" 2>/dev/null + +echo "✅ Vite server killed!" +echo "" +echo "🔧 Management commands:" +echo " rds # Start both Rails and Vite servers" +echo " crs # Check server status" +echo " krs # Kill Rails server only" +echo " kvs # Kill Vite server only (this command)" +echo " rvs # Start just Vite server" +echo " kas # Kill all servers" diff --git a/scripts/rds.sh b/scripts/rds.sh new file mode 100755 index 0000000000..cea24f93c0 --- /dev/null +++ b/scripts/rds.sh @@ -0,0 +1,40 @@ +#!/bin/bash +echo "🚀 Starting Rails and Vite servers..." +echo "" + +# Kill any existing servers first +echo "Stopping any existing servers..." +pkill -f "bin/rails s" 2>/dev/null || true +pkill -f "bin/vite dev" 2>/dev/null || true +sleep 1 + +echo "Starting Rails server in background..." +(bin/rails s > /tmp/rails.log 2>&1 &) +RAILS_PID=$! + +echo "Starting Vite server in background..." +(bin/vite dev > /tmp/vite.log 2>&1 &) +VITE_PID=$! + +sleep 3 + +echo "" +echo "✅ Both servers started!" +echo "Rails: http://localhost:3000 (PID: $RAILS_PID)" +echo "Vite: http://localhost:3036 (PID: $VITE_PID)" +echo "" +echo "📋 To view server logs:" +echo " tail -f /tmp/rails.log # Rails server (trs)" +echo " tail -f /tmp/vite.log # Vite server (tvs)" +echo "" +echo "🔧 Management commands:" +echo " rds # Start both Rails and Vite servers" +echo " crs # Check server status" +echo " krs # Kill Rails server only" +echo " kvs # Kill Vite server only" +echo " rvs # Start just Vite server" +echo " kas # Kill all servers" +echo "" +echo "🌐 Access URLs:" +echo " Rails: http://localhost:3000" +echo " Vite: http://localhost:3036" diff --git a/scripts/rvs.sh b/scripts/rvs.sh new file mode 100755 index 0000000000..8a531747cf --- /dev/null +++ b/scripts/rvs.sh @@ -0,0 +1,31 @@ +#!/bin/bash +echo "⚡ Starting Vite server..." +echo "" + +# Kill any existing Vite server first +echo "Stopping any existing Vite server..." +pkill -f "bin/vite dev" 2>/dev/null || true +pkill -f "vite" 2>/dev/null || true +sleep 1 + +echo "Starting Vite server in background..." +(bin/vite dev > /tmp/vite.log 2>&1 &) +VITE_PID=$! + +sleep 3 + +echo "" +echo "✅ Vite server started!" +echo "Vite: http://localhost:3036 (PID: $VITE_PID)" +echo "" +echo "📋 To view Vite logs:" +echo " tail -f /tmp/vite.log" +echo "" +echo "🔧 Management commands:" +echo " rds # Start both Rails and Vite servers" +echo " crs # Check server status" +echo " krs # Kill Rails server only" +echo " kvs # Kill Vite server only" +echo " rvs # Start just Vite server" +echo " kas # Kill all servers" +🌐 Access URL: \ No newline at end of file diff --git a/zshenv b/zshenv new file mode 100644 index 0000000000..43b225374c --- /dev/null +++ b/zshenv @@ -0,0 +1,3 @@ +# Homebrew: If you receive "highlighters directory not found" error message, you may need to add the following to your .zshenv: + +export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/usr/local/share/zsh-syntax-highlighting/highlighters diff --git a/zshrc b/zshrc index 0cebe11525..7af1dfd692 100644 --- a/zshrc +++ b/zshrc @@ -70,3 +70,4 @@ export EDITOR=code # Set ipdb as the default Python debugger export PYTHONBREAKPOINT=ipdb.set_trace +