-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
402 lines (338 loc) · 13 KB
/
Makefile
File metadata and controls
402 lines (338 loc) · 13 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# Polyglot Development Environment Makefile
# Comprehensive automation for multi-language development
# Variables
NU = nu
NODE = node
DEVBOX = devbox
COUNT ?= 1
# Colors for output
RED = \033[0;31m
GREEN = \033[0;32m
YELLOW = \033[1;33m
BLUE = \033[0;34m
PURPLE = \033[0;35m
CYAN = \033[0;36m
NC = \033[0m # No Color
# Default target
.PHONY: help
help:
@echo "$(CYAN)Polyglot Development Environment$(NC)"
@echo "$(YELLOW)================================$(NC)"
@echo ""
@echo "$(GREEN)🚀 Setup & Installation:$(NC)"
@echo " make setup - Complete automated setup"
@echo " make install-deps - Install system dependencies"
@echo " make setup-envs - Setup all development environments"
@echo " make validate - Validate all environments"
@echo ""
@echo "$(GREEN)🤖 MCP Server:$(NC)"
@echo " make mcp-build - Build MCP server"
@echo " make mcp-start - Start MCP server"
@echo " make mcp-test - Test MCP server"
@echo ""
@echo "$(GREEN)🐳 DevPod Containers:$(NC)"
@echo " make devpod-python - Create Python workspace(s) [COUNT=n]"
@echo " make devpod-typescript - Create TypeScript workspace(s) [COUNT=n]"
@echo " make devpod-rust - Create Rust workspace(s) [COUNT=n]"
@echo " make devpod-go - Create Go workspace(s) [COUNT=n]"
@echo " make devpod-list - List all DevPod workspaces"
@echo " make devpod-clean - Clean up all DevPod workspaces"
@echo ""
@echo "$(GREEN)🔍 Validation & Testing:$(NC)"
@echo " make test - Run tests in all environments"
@echo " make test-python - Run Python tests"
@echo " make test-typescript - Run TypeScript tests"
@echo " make test-rust - Run Rust tests"
@echo " make test-go - Run Go tests"
@echo " make test-nushell - Run Nushell tests"
@echo " make validate-quick - Quick validation check"
@echo " make validate-parallel - Parallel validation"
@echo ""
@echo "$(GREEN)🛠️ Development:$(NC)"
@echo " make format - Format code in all environments"
@echo " make lint - Lint code in all environments"
@echo " make clean - Clean all environments"
@echo " make deps-update - Update dependencies"
@echo ""
@echo "$(GREEN)📊 Monitoring & Analytics:$(NC)"
@echo " make perf-dashboard - Show performance dashboard"
@echo " make perf-report - Generate performance report"
@echo " make security-scan - Run security scan"
@echo " make resource-monitor - Monitor system resources"
@echo ""
@echo "$(GREEN)🔧 Utilities:$(NC)"
@echo " make env-status - Show environment status"
@echo " make install-hooks - Install Claude Code hooks"
@echo " make update-docs - Update documentation"
@echo ""
@echo "$(YELLOW)Examples:$(NC)"
@echo " make devpod-python COUNT=3 # Create 3 Python workspaces"
@echo " make test-rust # Run Rust tests only"
@echo " make validate-parallel # Fast parallel validation"
# ============================================================================
# Setup & Installation
# ============================================================================
.PHONY: setup
setup: install-deps setup-envs validate mcp-build
@echo "$(GREEN)✅ Complete setup finished!$(NC)"
@echo "$(CYAN)Next steps:$(NC)"
@echo " 1. Start MCP server: make mcp-start"
@echo " 2. Test environments: make validate"
@echo " 3. Create DevPod workspace: make devpod-python"
.PHONY: install-deps
install-deps:
@echo "$(BLUE)📦 Installing system dependencies...$(NC)"
@if ! command -v nu >/dev/null 2>&1; then \
echo "$(RED)❌ Nushell not found. Please install it first.$(NC)"; \
echo "$(YELLOW)See README.md for installation instructions.$(NC)"; \
exit 1; \
fi
@if ! command -v devbox >/dev/null 2>&1; then \
echo "$(YELLOW)⚠️ Installing DevBox...$(NC)"; \
curl -fsSL https://get.jetify.com/devbox | bash; \
fi
@echo "$(GREEN)✅ Dependencies installed$(NC)"
.PHONY: setup-envs
setup-envs:
@echo "$(BLUE)🏗️ Setting up development environments...$(NC)"
@cd dev-env/python && $(DEVBOX) run install || true
@cd dev-env/typescript && $(DEVBOX) run install || true
@cd dev-env/rust && $(DEVBOX) run build || true
@cd dev-env/go && $(DEVBOX) run build || true
@cd dev-env/nushell && $(DEVBOX) run setup || true
@echo "$(GREEN)✅ All environments setup complete$(NC)"
# ============================================================================
# MCP Server Management
# ============================================================================
.PHONY: mcp-build
mcp-build:
@echo "$(BLUE)🔨 Building MCP server...$(NC)"
@cd mcp && npm install && npm run build
@echo "$(GREEN)✅ MCP server built successfully$(NC)"
.PHONY: mcp-start
mcp-start:
@echo "$(BLUE)🚀 Starting MCP server...$(NC)"
@cd mcp && npm run start
.PHONY: mcp-test
mcp-test:
@echo "$(BLUE)🧪 Testing MCP server...$(NC)"
@echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}' | $(NODE) mcp/dist/index.js
.PHONY: mcp-watch
mcp-watch:
@echo "$(BLUE)👀 Starting MCP server in watch mode...$(NC)"
@cd mcp && npm run watch
# ============================================================================
# DevPod Container Management
# ============================================================================
.PHONY: devpod-python
devpod-python:
@echo "$(BLUE)🐍 Creating $(COUNT) Python DevPod workspace(s)...$(NC)"
@$(NU) .claude/commands/devpod-python.md $(COUNT)
.PHONY: devpod-typescript
devpod-typescript:
@echo "$(BLUE)📘 Creating $(COUNT) TypeScript DevPod workspace(s)...$(NC)"
@$(NU) .claude/commands/devpod-typescript.md $(COUNT)
.PHONY: devpod-rust
devpod-rust:
@echo "$(BLUE)🦀 Creating $(COUNT) Rust DevPod workspace(s)...$(NC)"
@$(NU) .claude/commands/devpod-rust.md $(COUNT)
.PHONY: devpod-go
devpod-go:
@echo "$(BLUE)🐹 Creating $(COUNT) Go DevPod workspace(s)...$(NC)"
@$(NU) .claude/commands/devpod-go.md $(COUNT)
.PHONY: devpod-list
devpod-list:
@echo "$(BLUE)📋 Listing DevPod workspaces...$(NC)"
@devpod list
.PHONY: devpod-clean
devpod-clean:
@echo "$(YELLOW)🧹 Cleaning up DevPod workspaces...$(NC)"
@$(NU) dev-env/nushell/scripts/containers.nu cleanup --all
# ============================================================================
# Testing & Validation
# ============================================================================
.PHONY: validate
validate:
@echo "$(BLUE)✅ Running full validation...$(NC)"
@$(NU) scripts/validate-all.nu --parallel
.PHONY: validate-quick
validate-quick:
@echo "$(BLUE)⚡ Running quick validation...$(NC)"
@$(NU) scripts/validate-all.nu quick
.PHONY: validate-parallel
validate-parallel:
@echo "$(BLUE)🚀 Running parallel validation...$(NC)"
@$(NU) scripts/validate-all.nu --parallel
.PHONY: test
test: test-python test-typescript test-rust test-go test-nushell
.PHONY: test-python
test-python:
@echo "$(BLUE)🐍 Running Python tests...$(NC)"
@cd dev-env/python && $(DEVBOX) run test
.PHONY: test-typescript
test-typescript:
@echo "$(BLUE)📘 Running TypeScript tests...$(NC)"
@cd dev-env/typescript && $(DEVBOX) run test
.PHONY: test-rust
test-rust:
@echo "$(BLUE)🦀 Running Rust tests...$(NC)"
@cd dev-env/rust && $(DEVBOX) run test
.PHONY: test-go
test-go:
@echo "$(BLUE)🐹 Running Go tests...$(NC)"
@cd dev-env/go && $(DEVBOX) run test
.PHONY: test-nushell
test-nushell:
@echo "$(BLUE)🐚 Running Nushell tests...$(NC)"
@cd dev-env/nushell && $(DEVBOX) run test
# ============================================================================
# Code Quality
# ============================================================================
.PHONY: format
format:
@echo "$(BLUE)🎨 Formatting code in all environments...$(NC)"
@cd dev-env/python && $(DEVBOX) run format
@cd dev-env/typescript && $(DEVBOX) run format
@cd dev-env/rust && $(DEVBOX) run format
@cd dev-env/go && $(DEVBOX) run format
@cd dev-env/nushell && $(DEVBOX) run format
.PHONY: lint
lint:
@echo "$(BLUE)🔍 Linting code in all environments...$(NC)"
@cd dev-env/python && $(DEVBOX) run lint
@cd dev-env/typescript && $(DEVBOX) run lint
@cd dev-env/rust && $(DEVBOX) run lint
@cd dev-env/go && $(DEVBOX) run lint
@cd dev-env/nushell && $(DEVBOX) run check
.PHONY: clean
clean:
@echo "$(YELLOW)🧹 Cleaning all environments...$(NC)"
@$(NU) dev-env/nushell/scripts/deploy.nu clean-all
.PHONY: deps-update
deps-update:
@echo "$(BLUE)📦 Updating dependencies...$(NC)"
@cd dev-env/python && $(DEVBOX) update
@cd dev-env/typescript && $(DEVBOX) update
@cd dev-env/rust && $(DEVBOX) update
@cd dev-env/go && $(DEVBOX) update
@cd dev-env/nushell && $(DEVBOX) update
# ============================================================================
# Monitoring & Analytics
# ============================================================================
.PHONY: perf-dashboard
perf-dashboard:
@echo "$(BLUE)📊 Showing performance dashboard...$(NC)"
@$(NU) dev-env/nushell/scripts/performance-analytics.nu dashboard
.PHONY: perf-report
perf-report:
@echo "$(BLUE)📈 Generating performance report...$(NC)"
@$(NU) dev-env/nushell/scripts/performance-analytics.nu report --days 7
.PHONY: security-scan
security-scan:
@echo "$(BLUE)🔒 Running security scan...$(NC)"
@$(NU) dev-env/nushell/scripts/security-scanner.nu scan-all
.PHONY: resource-monitor
resource-monitor:
@echo "$(BLUE)📊 Monitoring system resources...$(NC)"
@$(NU) dev-env/nushell/scripts/resource-monitor.nu watch --interval 30
# ============================================================================
# Utilities
# ============================================================================
.PHONY: env-status
env-status:
@echo "$(BLUE)📋 Environment status:$(NC)"
@$(NU) dev-env/nushell/scripts/list.nu
.PHONY: install-hooks
install-hooks:
@echo "$(BLUE)🪝 Installing Claude Code hooks...$(NC)"
@./.claude/install-hooks.sh
.PHONY: update-docs
update-docs:
@echo "$(BLUE)📚 Updating documentation...$(NC)"
@$(NU) dev-env/nushell/scripts/docs-automation.nu generate
.PHONY: polyglot-check
polyglot-check:
@echo "$(BLUE)🔍 Running polyglot health check...$(NC)"
@$(NU) -c "use dev-env/nushell/common.nu *; polyglot-check"
.PHONY: logs
logs:
@echo "$(BLUE)📝 Showing recent logs...$(NC)"
@tail -f ~/.claude/notifications.log
# ============================================================================
# Development Shortcuts
# ============================================================================
.PHONY: dev-python
dev-python:
@echo "$(BLUE)🐍 Entering Python development environment...$(NC)"
@cd dev-env/python && $(DEVBOX) shell
.PHONY: dev-typescript
dev-typescript:
@echo "$(BLUE)📘 Entering TypeScript development environment...$(NC)"
@cd dev-env/typescript && $(DEVBOX) shell
.PHONY: dev-rust
dev-rust:
@echo "$(BLUE)🦀 Entering Rust development environment...$(NC)"
@cd dev-env/rust && $(DEVBOX) shell
.PHONY: dev-go
dev-go:
@echo "$(BLUE)🐹 Entering Go development environment...$(NC)"
@cd dev-env/go && $(DEVBOX) shell
.PHONY: dev-nushell
dev-nushell:
@echo "$(BLUE)🐚 Entering Nushell development environment...$(NC)"
@cd dev-env/nushell && $(DEVBOX) shell
# ============================================================================
# CI/CD Targets
# ============================================================================
.PHONY: ci-test
ci-test: validate test lint
@echo "$(GREEN)✅ All CI tests passed$(NC)"
.PHONY: pre-commit
pre-commit: format lint test-nushell
@echo "$(GREEN)✅ Pre-commit checks passed$(NC)"
.PHONY: release-check
release-check: clean setup validate mcp-test
@echo "$(GREEN)✅ Release checks passed$(NC)"
# ============================================================================
# Emergency & Recovery
# ============================================================================
.PHONY: emergency-reset
emergency-reset:
@echo "$(RED)🚨 Emergency reset - this will clean everything!$(NC)"
@echo "$(YELLOW)Press Ctrl+C to cancel, or wait 5 seconds to continue...$(NC)"
@sleep 5
@$(NU) dev-env/nushell/scripts/deploy.nu emergency-reset
.PHONY: backup
backup:
@echo "$(BLUE)💾 Creating backup...$(NC)"
@$(NU) dev-env/nushell/scripts/deploy.nu backup
# ============================================================================
# Help for specific topics
# ============================================================================
.PHONY: help-setup
help-setup:
@echo "$(CYAN)Setup Help$(NC)"
@echo "$(YELLOW)==========$(NC)"
@echo "1. Install Nushell: See README.md for OS-specific instructions"
@echo "2. Run: make setup"
@echo "3. Verify: make validate"
@echo "4. Start MCP: make mcp-start"
.PHONY: help-devpod
help-devpod:
@echo "$(CYAN)DevPod Help$(NC)"
@echo "$(YELLOW)===========$(NC)"
@echo "Create workspaces: make devpod-python COUNT=3"
@echo "List workspaces: make devpod-list"
@echo "Clean workspaces: make devpod-clean"
.PHONY: help-mcp
help-mcp:
@echo "$(CYAN)MCP Server Help$(NC)"
@echo "$(YELLOW)===============$(NC)"
@echo "Build: make mcp-build"
@echo "Start: make mcp-start"
@echo "Test: make mcp-test"
@echo "Watch: make mcp-watch"
# Make sure intermediate files are not deleted
.SECONDARY:
# Default goal
.DEFAULT_GOAL := help