forked from CaviraOSS/OpenMemory
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
176 lines (144 loc) · 5.26 KB
/
Makefile
File metadata and controls
176 lines (144 loc) · 5.26 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# Makefile for OpenMemory
.PHONY: help install build test clean dev start stop lint format
# Default target
help: ## Show this help message
@echo "OpenMemory Development Commands"
@echo "==============================="
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
# Installation and Setup
install: ## Install all dependencies
@echo "📦 Installing backend dependencies..."
cd backend && npm install
@echo "📦 Installing JavaScript SDK dependencies..."
cd sdk-js && npm install
@echo "📦 Installing Python SDK dependencies..."
cd sdk-py && pip install -e .
@echo "✅ All dependencies installed!"
install-dev: ## Install development dependencies
@echo "🛠️ Installing development dependencies..."
cd backend && npm install
cd sdk-js && npm install
cd sdk-py && pip install -e .[dev]
@echo "✅ Development dependencies installed!"
# Build
build: ## Build all components
@echo "🏗️ Building backend..."
cd backend && npm run build
@echo "🏗️ Building JavaScript SDK..."
cd sdk-js && npm run build
@echo "✅ All components built!"
build-backend: ## Build backend only
cd backend && npm run build
build-js-sdk: ## Build JavaScript SDK only
cd sdk-js && npm run build
# Development
dev: ## Start development server
@echo "🚀 Starting development server..."
cd backend && npm run dev
dev-watch: ## Start development server with file watching
@echo "👀 Starting development server with watching..."
cd backend && npm run dev
# Production
start: ## Start production server
@echo "🚀 Starting production server..."
cd backend && npm start
stop: ## Stop server (if running as daemon)
@echo "🛑 Stopping server..."
@pkill -f "node.*openmemory" || echo "No server process found"
# Testing
test: ## Run all tests
@echo "🧪 Running all tests..."
@echo "Testing backend API..."
node tests/backend/api-simple.test.js
@echo "Testing JavaScript SDK..."
node tests/js-sdk/sdk-simple.test.js
@echo "Testing Python SDK..."
cd tests/py-sdk && python test-simple.py
test-backend: ## Run backend tests only
@echo "🧪 Testing backend API..."
node tests/backend/api-simple.test.js
test-js-sdk: ## Run JavaScript SDK tests only
@echo "🧪 Testing JavaScript SDK..."
node tests/js-sdk/sdk-simple.test.js
test-py-sdk: ## Run Python SDK tests only
@echo "🧪 Testing Python SDK..."
cd tests/py-sdk && python test-simple.py
test-integration: ## Run integration tests
@echo "🔗 Running integration tests..."
node tests/backend/api.test.js
# Code Quality
lint: ## Run linters
@echo "🔍 Running linters..."
cd backend && npm run lint || echo "Backend linting completed"
cd sdk-js && npm run lint || echo "JS SDK linting completed"
cd sdk-py && python -m flake8 . || echo "Python linting completed"
format: ## Format code
@echo "🎨 Formatting code..."
cd backend && npm run format || echo "Backend formatting completed"
cd sdk-js && npm run format || echo "JS SDK formatting completed"
cd sdk-py && python -m black . || echo "Python formatting completed"
type-check: ## Run type checking
@echo "🏷️ Running type checks..."
cd backend && npx tsc --noEmit
cd sdk-js && npx tsc --noEmit
# Database
db-reset: ## Reset database
@echo "🗄️ Resetting database..."
rm -f backend/database/*.db
@echo "✅ Database reset!"
db-backup: ## Backup database
@echo "💾 Backing up database..."
mkdir -p backups
cp backend/database/*.db backups/ || echo "No database files found"
@echo "✅ Database backed up!"
# Docker
docker-build: ## Build Docker image
@echo "🐳 Building Docker image..."
docker build -t openmemory .
docker-run: ## Run Docker container
@echo "🐳 Running Docker container..."
docker run -p 8080:8080 openmemory
docker-dev: ## Run development environment with Docker
@echo "🐳 Starting development environment..."
docker-compose up --build
docker-stop: ## Stop Docker containers
@echo "🐳 Stopping Docker containers..."
docker-compose down
run: docker-dev ## Alias for docker-dev
# Cleanup
clean: ## Clean build artifacts
@echo "🧹 Cleaning build artifacts..."
rm -rf backend/dist/
rm -rf sdk-js/dist/
rm -rf sdk-js/node_modules/.cache/
rm -rf backend/node_modules/.cache/
find . -name "*.pyc" -delete
find . -name "__pycache__" -type d -exec rm -rf {} + || true
@echo "✅ Cleanup complete!"
clean-all: clean ## Clean everything including node_modules
@echo "🧹 Deep cleaning..."
rm -rf backend/node_modules/
rm -rf sdk-js/node_modules/
rm -rf sdk-py/build/
rm -rf sdk-py/dist/
rm -rf sdk-py/*.egg-info/
@echo "✅ Deep cleanup complete!"
# Examples
run-examples: ## Run example files
@echo "🎯 Running examples..."
@echo "Backend examples:"
node examples/backend/basic-server.js &
sleep 2
node examples/backend/api-test.mjs
@echo "JavaScript SDK examples:"
node examples/js-sdk/basic-usage.js
@echo "Python SDK examples:"
cd examples/py-sdk && python basic_usage.py
# Development Utilities
reset-dev: clean install build ## Reset development environment
@echo "🔄 Development environment reset complete!"
quick-test: build test-backend ## Quick test after build
@echo "⚡ Quick test complete!"
full-check: clean install build lint test ## Full check before commit
@echo "✅ Full check complete - ready to commit!"