Skip to content

Commit 7b504a3

Browse files
committed
copy context
1 parent 2fd50c7 commit 7b504a3

File tree

3 files changed

+226
-18
lines changed

3 files changed

+226
-18
lines changed

README.md

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,28 @@ This Laravel 12 project has been configured with Claude Code and optimized MCP s
3131
- **Node.js 20+** - For frontend asset compilation
3232
- **Claude Code** - AI development assistant
3333

34-
### Install in your project
34+
### Installation Options
35+
36+
**Option 1: One-line installation (recommended)**
3537
```bash
3638
curl -fsSL https://raw.githubusercontent.com/chrisbaswell/laravel-claude-code-setup/main/setup.sh | bash
3739
```
3840

41+
**Option 2: Download and run manually**
42+
```bash
43+
curl -O https://raw.githubusercontent.com/chrisbaswell/laravel-claude-code-setup/main/setup.sh
44+
chmod +x setup.sh
45+
./setup.sh
46+
```
47+
48+
**Option 3: Clone the repository**
49+
```bash
50+
git clone https://github.com/chrisbaswell/laravel-claude-code-setup.git
51+
cd laravel-claude-code-setup
52+
./setup.sh
53+
# Copy setup files to your Laravel project when prompted
54+
```
55+
3956
### Setup Steps
4057

4158
1. **Run pre-installation check (recommended):**
@@ -308,16 +325,33 @@ npx playwright test --debug # Debug mode
308325
- Write tests using Pest PHP for better readability
309326
- Use the provided shortcuts for common development tasks
310327

311-
## Documentation
328+
## Project Context Files
329+
330+
The setup script automatically creates comprehensive documentation in `.claude/context/`:
331+
332+
### Core Development Guides
333+
- **Laravel 12 guidelines** (`laravel12_guidelines.md`) - Latest Laravel 12 features and patterns
334+
- **Livewire Volt patterns** (`livewire_volt_guidelines.md`) - Functional component development
335+
- **FluxUI reference** (`fluxui_guidelines.md`) - Component usage and best practices
336+
- **Livewire + Alpine.js** (`livewire_alpine_context.md`) - Frontend integration patterns
337+
338+
### Project Organization
339+
- **Project context** (`project-context.md`) - Tech stack overview and conventions
340+
- **Project structure** (`project_structure.md`) - File organization guidelines
341+
- **Coding standards** (`coding-standards.md`) - Project-specific code quality rules
312342

313-
- Project context: `.claude/context/project-context.md`
314-
- Laravel 12 guidelines: `.claude/context/laravel12_guidelines.md`
315-
- FluxUI reference: `.claude/context/fluxui_guidelines.md`
316-
- Livewire Volt patterns: `.claude/context/livewire_volt_guidelines.md`
317-
- Playwright testing: `.claude/context/playwright_testing.md`
318-
- Web automation guide: `.claude/context/web_automation_guide.md`
319-
- Laravel Herd development: `.claude/context/herd_development.md`
320-
- NetSuite integration: `.claude/context/netsuite_context.md`
343+
### Testing & Automation
344+
- **Playwright testing** (`playwright_testing.md`) - End-to-end testing with Playwright MCP
345+
- **Web automation guide** (`web_automation_guide.md`) - Playwright vs Fetch MCP usage
346+
- **Herd development** (`herd_development.md`) - Local development with Laravel Herd
347+
348+
### Quick References
349+
- **FluxUI quick reference** (`fluxui-reference.md`) - Component cheat sheet
350+
351+
### Optional Project-Specific
352+
- **NetSuite integration** (`netsuite_context.md`) - Business system integration (if applicable)
353+
354+
## Documentation
321355

322356
## Development Shortcuts
323357

pre-check.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ else
113113
((ISSUES_FOUND++))
114114
fi
115115

116+
# Check curl
117+
if command -v curl &> /dev/null; then
118+
print_success "curl available"
119+
else
120+
print_error "curl not found (required for downloading context files)"
121+
((ISSUES_FOUND++))
122+
fi
123+
116124
# Check Claude Code
117125
if command -v claude &> /dev/null; then
118126
CLAUDE_VERSION=$(claude --version 2>/dev/null || echo "unknown")

setup.sh

Lines changed: 174 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,138 @@ EOF
11051105
Generated: $(date)
11061106
EOF
11071107

1108+
# Copy or download all context files from the repository
1109+
SCRIPT_DIR="$(dirname "$0")"
1110+
REPO_BASE_URL="https://raw.githubusercontent.com/chrisbaswell/laravel-claude-code-setup/main"
1111+
1112+
# Function to copy local file or download from repo
1113+
copy_or_download_context_file() {
1114+
local filename="$1"
1115+
local description="$2"
1116+
1117+
print_status "Installing $description..."
1118+
if [ -f "$SCRIPT_DIR/.claude/context/$filename" ]; then
1119+
cp "$SCRIPT_DIR/.claude/context/$filename" ".claude/context/"
1120+
print_success "$description copied from local repository"
1121+
else
1122+
print_status "$description not found locally, downloading from repository..."
1123+
if curl -fsSL "$REPO_BASE_URL/.claude/context/$filename" -o ".claude/context/$filename"; then
1124+
print_success "$description downloaded successfully"
1125+
else
1126+
print_warning "Failed to download $description, creating basic version"
1127+
return 1
1128+
fi
1129+
fi
1130+
return 0
1131+
}
1132+
1133+
# Install Laravel 12 guidelines
1134+
if ! copy_or_download_context_file "laravel12_guidelines.md" "Laravel 12 guidelines"; then
1135+
cat > ".claude/context/laravel12_guidelines.md" << 'EOF'
1136+
# Laravel 12 Development Guidelines
1137+
1138+
## Core Laravel 12 Features
1139+
1140+
### New Attribute Class for Accessors/Mutators
1141+
Laravel 12 introduces the `Attribute` class for cleaner accessor and mutator definitions.
1142+
1143+
### Modern Application Configuration
1144+
Use the streamlined Application class in `bootstrap/app.php`.
1145+
1146+
### Enhanced Validation
1147+
Leverage Laravel 12's improved validation features.
1148+
1149+
Generated: $(date)
1150+
EOF
1151+
fi
1152+
1153+
# Install Livewire Volt guidelines
1154+
if ! copy_or_download_context_file "livewire_volt_guidelines.md" "Livewire Volt guidelines"; then
1155+
cat > ".claude/context/livewire_volt_guidelines.md" << 'EOF'
1156+
# Livewire Volt Development Guidelines
1157+
1158+
## Volt Functional Components
1159+
Use Volt for modern, functional component development with Livewire.
1160+
1161+
Generated: $(date)
1162+
EOF
1163+
fi
1164+
1165+
# Install FluxUI guidelines
1166+
if ! copy_or_download_context_file "fluxui_guidelines.md" "FluxUI guidelines"; then
1167+
cat > ".claude/context/fluxui_guidelines.md" << 'EOF'
1168+
# FluxUI Development Guidelines
1169+
1170+
## Component Usage
1171+
Always prefer FluxUI components over custom HTML/CSS.
1172+
1173+
Generated: $(date)
1174+
EOF
1175+
fi
1176+
1177+
# Install Livewire Alpine context
1178+
if ! copy_or_download_context_file "livewire_alpine_context.md" "Livewire Alpine context"; then
1179+
cat > ".claude/context/livewire_alpine_context.md" << 'EOF'
1180+
# Livewire + Alpine.js Integration
1181+
1182+
## Best Practices
1183+
Combine Livewire with Alpine.js for optimal interactivity.
1184+
1185+
Generated: $(date)
1186+
EOF
1187+
fi
1188+
1189+
# Install project structure guide
1190+
if ! copy_or_download_context_file "project_structure.md" "project structure guide"; then
1191+
cat > ".claude/context/project_structure.md" << 'EOF'
1192+
# Project Structure Guide
1193+
1194+
## Laravel 12 Project Organization
1195+
Follow Laravel 12 conventions for project structure.
1196+
1197+
Generated: $(date)
1198+
EOF
1199+
fi
1200+
1201+
# Install Playwright testing guide
1202+
if ! copy_or_download_context_file "playwright_testing.md" "Playwright testing guide"; then
1203+
cat > ".claude/context/playwright_testing.md" << 'EOF'
1204+
# Playwright Testing Guide
1205+
1206+
## End-to-End Testing
1207+
Use Playwright for comprehensive E2E testing.
1208+
1209+
Generated: $(date)
1210+
EOF
1211+
fi
1212+
1213+
# Install web automation guide
1214+
if ! copy_or_download_context_file "web_automation_guide.md" "web automation guide"; then
1215+
cat > ".claude/context/web_automation_guide.md" << 'EOF'
1216+
# Web Automation Guide
1217+
1218+
## Playwright vs Fetch MCP
1219+
Choose the right tool for web automation tasks.
1220+
1221+
Generated: $(date)
1222+
EOF
1223+
fi
1224+
1225+
# Install Herd development guide
1226+
if ! copy_or_download_context_file "herd_development.md" "Herd development guide"; then
1227+
cat > ".claude/context/herd_development.md" << 'EOF'
1228+
# Laravel Herd Development Guide
1229+
1230+
## Local Development with Herd
1231+
Use Laravel Herd for zero-configuration local development.
1232+
1233+
Generated: $(date)
1234+
EOF
1235+
fi
1236+
1237+
# Install NetSuite context (optional)
1238+
copy_or_download_context_file "netsuite_context.md" "NetSuite context" || print_status "NetSuite context skipped (project-specific)"
1239+
11081240
# Create FluxUI quick reference
11091241
print_status "Creating FluxUI quick reference..."
11101242
cat > ".claude/context/fluxui-reference.md" << EOF
@@ -1387,21 +1519,55 @@ EOF
13871519

13881520
# Verify all files were created
13891521
local files_created=0
1390-
local expected_files=("context/project-context.md" "context/coding-standards.md" "context/fluxui-reference.md" "shortcuts.sh" "README.md")
1391-
1392-
for file in "${expected_files[@]}"; do
1522+
local required_files=(
1523+
"context/project-context.md"
1524+
"context/coding-standards.md"
1525+
"context/fluxui-reference.md"
1526+
"context/laravel12_guidelines.md"
1527+
"context/livewire_volt_guidelines.md"
1528+
"context/fluxui_guidelines.md"
1529+
"context/livewire_alpine_context.md"
1530+
"context/project_structure.md"
1531+
"context/playwright_testing.md"
1532+
"context/web_automation_guide.md"
1533+
"context/herd_development.md"
1534+
"shortcuts.sh"
1535+
"README.md"
1536+
)
1537+
1538+
local optional_files=(
1539+
"context/netsuite_context.md"
1540+
)
1541+
1542+
# Count required files
1543+
for file in "${required_files[@]}"; do
13931544
if [ -f ".claude/$file" ]; then
13941545
((files_created++))
13951546
else
1396-
print_error "Failed to create .claude/$file"
1547+
print_error "Failed to create required file: .claude/$file"
1548+
fi
1549+
done
1550+
1551+
# Count optional files
1552+
local optional_created=0
1553+
for file in "${optional_files[@]}"; do
1554+
if [ -f ".claude/$file" ]; then
1555+
((files_created++))
1556+
((optional_created++))
13971557
fi
13981558
done
13991559

1400-
if [ $files_created -eq ${#expected_files[@]} ]; then
1401-
print_success "Project context files created! ($files_created/${#expected_files[@]} files)"
1560+
local total_possible_files=$((${#required_files[@]} + ${#optional_files[@]}))
1561+
1562+
if [ $files_created -ge ${#required_files[@]} ]; then
1563+
print_success "All required context files created! ($files_created/$total_possible_files files total)"
1564+
if [ $optional_created -gt 0 ]; then
1565+
print_status "Optional files installed: $optional_created"
1566+
fi
14021567
return 0
14031568
else
1404-
print_error "Only $files_created/${#expected_files[@]} project files were created successfully"
1569+
print_error "Only $files_created/$total_possible_files project files were created successfully"
1570+
print_error "Missing required files. Check the installation output above."
14051571
return 1
14061572
fi
14071573
}
@@ -1497,7 +1663,7 @@ install_fluxui_and_volt() {
14971663
# Main installation function
14981664
main() {
14991665
echo "================================================"
1500-
echo "Laravel Claude Code Setup Script v3.1"
1666+
echo "Laravel Claude Code Setup Script v3.2"
15011667
echo "Laravel 12 + FluxUI + Playwright MCP Server"
15021668
echo "================================================"
15031669
echo ""

0 commit comments

Comments
 (0)