Skip to content

Commit 78216dd

Browse files
authored
Merge pull request #227 from DevanshuNEU/feat/dependency-graph-v2
feat: Dependency Graph V2 - Impact Analysis & Visual Redesign
2 parents 1a83150 + 060b1c7 commit 78216dd

10 files changed

Lines changed: 1136 additions & 430 deletions

File tree

Makefile

Lines changed: 41 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,54 @@
1-
.PHONY: help dev prod build test clean deploy
1+
# CodeIntel Development Makefile
2+
# Usage: make [target]
23

3-
# Default target
4-
help:
5-
@echo "CodeIntel - Development Commands"
6-
@echo ""
7-
@echo "Local Development:"
8-
@echo " make dev - Start local dev (uses .env.dev)"
9-
@echo " make dev-prod - Test prod config locally (uses .env.prod)"
10-
@echo " make stop - Stop all services"
11-
@echo " make clean - Stop and remove all containers/volumes"
12-
@echo " make logs - View all logs"
13-
@echo " make health - Check service health"
14-
@echo ""
15-
@echo "Testing:"
16-
@echo " make test - Run backend tests"
17-
@echo " make test-ws - Run WebSocket auth tests only"
18-
@echo " make coverage - Run tests with coverage report"
19-
@echo ""
20-
@echo "Deployment:"
21-
@echo " make deploy-backend - Deploy backend to Railway"
22-
@echo " make deploy-frontend - Deploy frontend to Vercel"
4+
.PHONY: f b all logs restart down status clean help
235

24-
# ============================================
25-
# LOCAL DEVELOPMENT
26-
# ============================================
6+
# Default target - rebuild frontend
7+
f frontend:
8+
@echo "🔄 Rebuilding frontend..."
9+
@docker compose build frontend
10+
@docker compose up -d frontend
11+
@echo "✅ Done"
2712

28-
# Development with .env.dev
29-
dev:
30-
@echo "🚀 Starting LOCAL DEV environment..."
31-
@cp .env.dev .env
32-
docker compose up -d --build
33-
@echo ""
34-
@echo "✅ Development environment started!"
35-
@echo " Backend: http://localhost:8000"
36-
@echo " API Docs: http://localhost:8000/docs"
37-
@echo " Frontend: http://localhost:3000"
38-
@echo " Redis: localhost:6379"
39-
@echo ""
40-
@echo "View logs: make logs"
13+
b backend:
14+
@echo "🔄 Rebuilding backend..."
15+
@docker compose build backend
16+
@docker compose up -d backend
17+
@echo "✅ Done"
4118

42-
# Test production config locally (uses .env.prod)
43-
dev-prod:
44-
@echo "🚀 Starting LOCAL environment with PROD config..."
45-
@cp .env.prod .env
46-
docker compose up -d --build
47-
@echo ""
48-
@echo "✅ Prod-config environment started!"
49-
@echo " Backend: http://localhost:8000"
50-
@echo " Frontend: http://localhost:3000"
19+
all:
20+
@docker compose build
21+
@docker compose up -d
5122

52-
# Stop services
53-
stop:
54-
docker compose down
55-
@echo "✅ Services stopped"
23+
up:
24+
@docker compose up -d
5625

57-
# Clean everything (including volumes)
58-
clean:
59-
docker compose down -v --remove-orphans
60-
@echo "✅ Cleaned all containers and volumes"
26+
down:
27+
@docker compose down
28+
29+
restart:
30+
@docker compose restart
6131

62-
# View logs
6332
logs:
64-
docker compose logs -f
33+
@docker compose logs -f frontend
6534

66-
# Logs for specific service
6735
logs-backend:
68-
docker compose logs -f backend
69-
70-
logs-frontend:
71-
docker compose logs -f frontend
72-
73-
# ============================================
74-
# TESTING
75-
# ============================================
76-
77-
# Run all backend tests
78-
test:
79-
cd backend && python3 -m pytest tests/ -v --no-cov
80-
81-
# Run WebSocket auth tests only
82-
test-ws:
83-
cd backend && python3 -m pytest tests/test_websocket_auth.py -v --no-cov
84-
85-
# Run tests with coverage
86-
coverage:
87-
cd backend && python3 -m pytest tests/ --cov=. --cov-report=html --cov-report=term
88-
@echo ""
89-
@echo "Coverage report: backend/htmlcov/index.html"
90-
91-
# ============================================
92-
# DEPLOYMENT
93-
# ============================================
36+
@docker compose logs -f backend
9437

95-
# Deploy backend to Railway
96-
deploy-backend:
97-
@echo "🚀 Deploying backend to Railway..."
98-
railway up
99-
@echo "✅ Backend deployed!"
38+
status ps:
39+
@docker compose ps
10040

101-
# Deploy frontend to Vercel
102-
deploy-frontend:
103-
@echo "🚀 Deploying frontend to Vercel..."
104-
cd frontend && vercel --prod
105-
@echo "✅ Frontend deployed!"
106-
107-
# Deploy everything
108-
deploy-all: deploy-backend deploy-frontend
109-
@echo "✅ All services deployed!"
110-
111-
# ============================================
112-
# UTILITIES
113-
# ============================================
114-
115-
# Check service health
116-
health:
117-
@echo "Checking services..."
118-
@curl -s http://localhost:8000/health | python3 -m json.tool 2>/dev/null || echo "❌ Backend not responding"
119-
@curl -s -o /dev/null -w "" http://localhost:3000 && echo "✅ Frontend is up" || echo "❌ Frontend not responding"
120-
@docker compose exec -T redis redis-cli ping 2>/dev/null | grep -q PONG && echo "✅ Redis is up" || echo "❌ Redis not responding"
121-
122-
# Shell into backend container
123-
shell-backend:
124-
docker compose exec backend bash
125-
126-
# Shell into Redis
127-
shell-redis:
128-
docker compose exec redis redis-cli
129-
130-
# Quick rebuild backend only
131-
rebuild-backend:
132-
docker compose up -d --build backend
133-
@echo "✅ Backend rebuilt and restarted"
41+
clean:
42+
@echo "⚠️ Full rebuild (slow)..."
43+
@docker compose build --no-cache
44+
@docker compose up -d
13445

135-
# Quick rebuild frontend only
136-
rebuild-frontend:
137-
docker compose up -d --build frontend
138-
@echo "✅ Frontend rebuilt and restarted"
46+
help:
47+
@echo "make f - Rebuild frontend (~10s)"
48+
@echo "make b - Rebuild backend"
49+
@echo "make all - Rebuild everything"
50+
@echo "make up - Start services"
51+
@echo "make down - Stop services"
52+
@echo "make logs - Frontend logs"
53+
@echo "make status - Container status"
54+
@echo "make clean - Full rebuild (slow)"

dev.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
# Quick rebuild script for CodeIntel development
3+
# Usage: ./dev.sh [frontend|backend|all]
4+
5+
set -e
6+
7+
cd "$(dirname "$0")"
8+
9+
case "${1:-frontend}" in
10+
frontend|f)
11+
echo "🔄 Rebuilding frontend only..."
12+
docker compose build frontend
13+
docker compose up -d frontend
14+
echo "✅ Frontend rebuilt in ~10s"
15+
;;
16+
backend|b)
17+
echo "🔄 Rebuilding backend only..."
18+
docker compose build backend
19+
docker compose up -d backend
20+
echo "✅ Backend rebuilt"
21+
;;
22+
all|a)
23+
echo "🔄 Rebuilding all services..."
24+
docker compose build
25+
docker compose up -d
26+
echo "✅ All services rebuilt"
27+
;;
28+
logs|l)
29+
docker compose logs -f "${2:-frontend}"
30+
;;
31+
restart|r)
32+
echo "🔄 Restarting ${2:-all} without rebuild..."
33+
if [ -n "$2" ]; then
34+
docker compose restart "$2"
35+
else
36+
docker compose restart
37+
fi
38+
;;
39+
down|d)
40+
docker compose down
41+
;;
42+
status|s)
43+
docker compose ps
44+
;;
45+
clean)
46+
echo "⚠️ Full rebuild with no cache..."
47+
docker compose build --no-cache
48+
docker compose up -d
49+
;;
50+
*)
51+
echo "Usage: ./dev.sh [command]"
52+
echo ""
53+
echo "Commands:"
54+
echo " frontend, f Rebuild frontend only (~10s)"
55+
echo " backend, b Rebuild backend only (~2min first time, cached after)"
56+
echo " all, a Rebuild all services"
57+
echo " logs, l [svc] Follow logs (default: frontend)"
58+
echo " restart, r Restart without rebuild"
59+
echo " down, d Stop all services"
60+
echo " status, s Show container status"
61+
echo " clean Full rebuild, no cache (slow!)"
62+
;;
63+
esac

frontend/Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Frontend Dockerfile - Multi-stage build
2-
FROM node:20-alpine AS builder
1+
# Frontend Dockerfile - Multi-stage build with Bun
2+
FROM oven/bun:1 AS builder
33

44
WORKDIR /app
55

@@ -13,17 +13,17 @@ ENV VITE_API_URL=$VITE_API_URL
1313
ENV VITE_SUPABASE_URL=$VITE_SUPABASE_URL
1414
ENV VITE_SUPABASE_ANON_KEY=$VITE_SUPABASE_ANON_KEY
1515

16-
# Copy package files
17-
COPY package*.json ./
16+
# Copy package files (lockfile required for deterministic builds)
17+
COPY package.json bun.lock ./
1818

19-
# Install dependencies
20-
RUN npm ci
19+
# Install dependencies (fail if lockfile missing or outdated)
20+
RUN bun install --frozen-lockfile
2121

2222
# Copy source code
2323
COPY . .
2424

2525
# Build for production
26-
RUN npm run build
26+
RUN bun run build
2727

2828
# Production image - nginx
2929
FROM nginx:alpine

0 commit comments

Comments
 (0)