-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.ps1
More file actions
140 lines (118 loc) · 4.47 KB
/
Copy pathsetup.ps1
File metadata and controls
140 lines (118 loc) · 4.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# CodeForge AI - Automated Setup Script for Windows
# Run with: .\setup.ps1
Write-Host "🚀 CodeForge AI - Automated Setup" -ForegroundColor Cyan
Write-Host "==================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "🔍 Checking prerequisites..." -ForegroundColor Yellow
# Check Python
try {
$pythonVersion = python --version
Write-Host "✓ Python found: $pythonVersion" -ForegroundColor Green
} catch {
Write-Host "❌ Python 3 is not installed" -ForegroundColor Red
Write-Host "Please install Python 3.11+ from https://python.org" -ForegroundColor Red
exit 1
}
# Check Node.js
try {
$nodeVersion = node --version
Write-Host "✓ Node.js found: $nodeVersion" -ForegroundColor Green
} catch {
Write-Host "❌ Node.js is not installed" -ForegroundColor Red
Write-Host "Please install Node.js 18+ from https://nodejs.org" -ForegroundColor Red
exit 1
}
# Check PostgreSQL
$pgFound = $false
try {
$pgVersion = psql --version
Write-Host "✓ PostgreSQL found: $pgVersion" -ForegroundColor Green
$pgFound = $true
} catch {
Write-Host "⚠ PostgreSQL not found" -ForegroundColor Yellow
Write-Host "Please install PostgreSQL 14+ from https://www.postgresql.org/download/windows/" -ForegroundColor Yellow
$continue = Read-Host "Continue anyway? (y/n)"
if ($continue -ne "y") {
exit 1
}
}
# Initialize database (matches setup.sh behavior)
if ($pgFound) {
$initSql = Join-Path $PSScriptRoot "database\init.sql"
if (Test-Path $initSql) {
Write-Host "📊 Running database initialization..." -ForegroundColor Yellow
try {
psql -U postgres -f $initSql 2>$null
Write-Host "✓ Database initialized" -ForegroundColor Green
} catch {
Write-Host "⚠ Database init may have already been applied or failed" -ForegroundColor Yellow
}
}
}
Write-Host ""
Write-Host "🐍 Setting up Python backend..." -ForegroundColor Yellow
Set-Location backend
# Create virtual environment
if (-not (Test-Path "venv")) {
Write-Host "Creating Python virtual environment..." -ForegroundColor Cyan
python -m venv venv
}
# Activate virtual environment
.\venv\Scripts\Activate.ps1
# Upgrade pip
python -m pip install --upgrade pip
# Install dependencies
Write-Host "Installing Python dependencies..." -ForegroundColor Cyan
pip install -r requirements.txt
# Create .env if doesn't exist
if (-not (Test-Path ".env")) {
Write-Host "Creating .env file..." -ForegroundColor Cyan
Copy-Item .env.example .env
Write-Host "⚠ Please edit backend\.env with your API credentials" -ForegroundColor Yellow
}
Write-Host "✓ Backend setup complete" -ForegroundColor Green
Set-Location ..
Write-Host ""
Write-Host "⚛️ Setting up React frontend..." -ForegroundColor Yellow
Set-Location frontend
# Install dependencies
Write-Host "Installing Node.js dependencies..." -ForegroundColor Cyan
npm install
# Create .env.local if doesn't exist
if (-not (Test-Path ".env.local")) {
Write-Host "Creating .env.local file..." -ForegroundColor Cyan
Copy-Item .env.local.example .env.local
}
Write-Host "✓ Frontend setup complete" -ForegroundColor Green
Set-Location ..
Write-Host ""
Write-Host "✓✓✓ Setup complete! ✓✓✓" -ForegroundColor Green
Write-Host ""
Write-Host "==================================" -ForegroundColor Cyan
Write-Host "📝 Next Steps:" -ForegroundColor Cyan
Write-Host "==================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "1. Configure API credentials:"
Write-Host " notepad backend\.env" -ForegroundColor Yellow
Write-Host ""
Write-Host " Required:"
Write-Host " - VENICE_API_KEY"
Write-Host " - VENICE_API_SECRET"
Write-Host " - GITHUB_PERSONAL_ACCESS_TOKEN"
Write-Host " - GITHUB_USERNAME"
Write-Host ""
Write-Host "2. Start the backend server:"
Write-Host " cd backend" -ForegroundColor Green
Write-Host " .\venv\Scripts\Activate.ps1" -ForegroundColor Green
Write-Host " python main.py" -ForegroundColor Green
Write-Host ""
Write-Host "3. In a new terminal, start the frontend:"
Write-Host " cd frontend" -ForegroundColor Green
Write-Host " npm run dev" -ForegroundColor Green
Write-Host ""
Write-Host "4. Open your browser:"
Write-Host " http://localhost:3000" -ForegroundColor Green
Write-Host ""
Write-Host "==================================" -ForegroundColor Cyan
Write-Host "🚀 Happy coding with CodeForge AI!" -ForegroundColor Cyan
Write-Host "==================================" -ForegroundColor Cyan