1+ #! /bin/bash
2+ 
3+ #  Pre-installation check script for Laravel Claude Code Setup
4+ #  Run this before setup.sh to identify potential issues
5+ 
6+ set  -e
7+ 
8+ #  Colors for output
9+ RED=' \033[0;31m' 
10+ GREEN=' \033[0;32m' 
11+ YELLOW=' \033[1;33m' 
12+ BLUE=' \033[0;34m' 
13+ NC=' \033[0m' #  No Color
14+ 
15+ print_status () {
16+     echo  -e " ${BLUE} [CHECK]${NC}  $1 " 
17+ }
18+ 
19+ print_success () {
20+     echo  -e " ${GREEN} [PASS]${NC}  $1 " 
21+ }
22+ 
23+ print_warning () {
24+     echo  -e " ${YELLOW} [WARN]${NC}  $1 " 
25+ }
26+ 
27+ print_error () {
28+     echo  -e " ${RED} [FAIL]${NC}  $1 " 
29+ }
30+ 
31+ print_header () {
32+     echo  -e " ${BLUE} === $1  ===${NC} " 
33+ }
34+ 
35+ echo  " Laravel Claude Code Setup - Pre-Installation Check" 
36+ echo  " =================================================" 
37+ echo  " " 
38+ 
39+ ISSUES_FOUND=0
40+ 
41+ print_header " Laravel Project Verification" 
42+ 
43+ #  Check if we're in a Laravel project
44+ if  [ !  -f  " artisan" ||  [ !  -f  " composer.json" ;  then 
45+     print_error " Not a Laravel project directory" 
46+     (( ISSUES_FOUND++ )) 
47+ else 
48+     print_success " Laravel project detected" 
49+ fi 
50+ 
51+ #  Check .env file
52+ if  [ !  -f  " .env" ;  then 
53+     print_error " .env file not found" 
54+     print_status " Copy .env.example to .env and configure it" 
55+     (( ISSUES_FOUND++ )) 
56+ else 
57+     print_success " .env file exists" 
58+     
59+     #  Check database configuration
60+     if  !  grep -q " ^DB_DATABASE=" ||  grep -q " ^DB_DATABASE=$" ;  then 
61+         print_warning " DB_DATABASE not configured in .env" 
62+         print_status " Database MCP integration will be skipped" 
63+         print_status " To fix: Set DB_DATABASE=your_database_name in .env" 
64+     else 
65+         print_success " Database configuration found" 
66+     fi 
67+ fi 
68+ 
69+ print_header " System Requirements" 
70+ 
71+ #  Check PHP version
72+ if  command  -v php & >  /dev/null;  then 
73+     PHP_VERSION=$( php -r " echo PHP_VERSION;" ) 
74+     if  [[ $( echo " $PHP_VERSION  8.3" |  awk ' {print ($1 >= $2)}' ) ==  " 1" ;  then 
75+         print_success " PHP $PHP_VERSION  (meets Laravel 12 requirement)" 
76+     else 
77+         print_error " PHP $PHP_VERSION  (Laravel 12 requires PHP 8.3+)" 
78+         (( ISSUES_FOUND++ )) 
79+     fi 
80+ else 
81+     print_error " PHP not found" 
82+     (( ISSUES_FOUND++ )) 
83+ fi 
84+ 
85+ #  Check Node.js version
86+ if  command  -v node & >  /dev/null;  then 
87+     NODE_VERSION=$( node --version |  sed ' s/v//' ) 
88+     NODE_MAJOR=$( echo $NODE_VERSION  |  cut -d. -f1) 
89+     if  [ " $NODE_MAJOR " -ge  20 ];  then 
90+         print_success " Node.js $NODE_VERSION  (meets requirement)" 
91+     else 
92+         print_warning " Node.js $NODE_VERSION  (recommended: 20+)" 
93+     fi 
94+ else 
95+     print_error " Node.js not found" 
96+     (( ISSUES_FOUND++ )) 
97+ fi 
98+ 
99+ #  Check npm
100+ if  command  -v npm & >  /dev/null;  then 
101+     NPM_VERSION=$( npm --version) 
102+     print_success " npm $NPM_VERSION " 
103+ else 
104+     print_error " npm not found" 
105+     (( ISSUES_FOUND++ )) 
106+ fi 
107+ 
108+ #  Check Git
109+ if  command  -v git & >  /dev/null;  then 
110+     print_success " Git available" 
111+ else 
112+     print_error " Git not found (required for MCP server installation)" 
113+     (( ISSUES_FOUND++ )) 
114+ fi 
115+ 
116+ #  Check Claude Code
117+ if  command  -v claude & >  /dev/null;  then 
118+     CLAUDE_VERSION=$( claude --version 2> /dev/null ||  echo  " unknown" ) 
119+     print_success " Claude Code installed ($CLAUDE_VERSION )" 
120+ else 
121+     print_error " Claude Code not found" 
122+     print_status " Install from: https://claude.ai/code" 
123+     (( ISSUES_FOUND++ )) 
124+ fi 
125+ 
126+ print_header " Optional Dependencies" 
127+ 
128+ #  Check Go (for database MCP server)
129+ if  command  -v go & >  /dev/null;  then 
130+     GO_VERSION=$( go version |  grep -o ' go[0-9]*\.[0-9]*' |  grep -o ' [0-9]*\.[0-9]*' ) 
131+     print_success " Go $GO_VERSION  (for database MCP server)" 
132+ else 
133+     print_warning " Go not found (database MCP server will be skipped)" 
134+     print_status " Install Go from: https://golang.org/dl/" 
135+ fi 
136+ 
137+ #  Check Laravel Herd
138+ if  command  -v herd & >  /dev/null;  then 
139+     print_success " Laravel Herd available" 
140+ else 
141+     print_warning " Laravel Herd not found" 
142+     print_status " Install from: https://herd.laravel.com" 
143+     print_status " Recommended for optimal local development experience" 
144+ fi 
145+ 
146+ print_header " Project Dependencies" 
147+ 
148+ #  Check if composer.json has required packages
149+ if  [ -f  " composer.json" ;  then 
150+     if  grep -q " livewire/flux" ;  then 
151+         print_success " FluxUI package found" 
152+     else 
153+         print_warning " FluxUI not installed" 
154+         print_status " Will be installed during setup if you choose" 
155+     fi 
156+     
157+     if  grep -q " livewire/volt" ;  then 
158+         print_success " Livewire Volt package found" 
159+     else 
160+         print_warning " Livewire Volt not installed" 
161+         print_status " Will be installed during setup if you choose" 
162+     fi 
163+ fi 
164+ 
165+ #  Check package.json for Playwright
166+ if  [ -f  " package.json" ;  then 
167+     if  grep -q " @playwright/test" ;  then 
168+         print_success " Playwright test package found" 
169+     else 
170+         print_warning " Playwright not in package.json" 
171+         print_status " Playwright browsers will need manual installation later" 
172+     fi 
173+ fi 
174+ 
175+ echo  " " 
176+ print_header " Summary" 
177+ 
178+ if  [ $ISSUES_FOUND  -eq  0 ];  then 
179+     print_success " All requirements met! Ready to run setup.sh" 
180+     echo  " " 
181+     echo  " Run: ./setup.sh" 
182+ else 
183+     print_error " Found $ISSUES_FOUND  critical issue(s) that need to be resolved" 
184+     echo  " " 
185+     echo  " Please fix the issues above before running setup.sh" 
186+ fi 
187+ 
188+ echo  " " 
189+ exit  $ISSUES_FOUND  
0 commit comments