-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
128 lines (104 loc) · 3.93 KB
/
Makefile
File metadata and controls
128 lines (104 loc) · 3.93 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
BACKEND_HOST ?= 127.0.0.1
BACKEND_PORT ?= 8040
FRONTEND_PORT ?= 3040
# Active domain: reads DEMO_DOMAIN from .env automatically.
# Override with: make <target> DOMAIN=electrohub
DOMAIN ?= $(or $(shell grep -s '^DEMO_DOMAIN=' .env | cut -d= -f2),reddash)
.PHONY: help domains setup reset dev backend frontend install \
backend-install frontend-install \
generate-models generate-data setup-surface load-data \
seed-memories seed-langcache seed-all flush-redis \
validate-domain smoke-domain create-domain
help:
@echo ""
@echo " make domains Show available domains"
@echo " make setup [DOMAIN=X] Full setup (first time or switch domain)"
@echo " make reset Reload data for current domain"
@echo " make dev Start backend + frontend"
@echo ""
@echo " make install Install Python + JS dependencies"
@echo " make seed-memories Re-seed long-term memories"
@echo " make seed-langcache Re-seed LangCache entries"
@echo " make flush-redis Wipe Redis (preserves Agent Memory)"
@echo ""
@echo " Active domain: $(DOMAIN)"
@echo ""
domains:
@echo ""
@echo "Available domains:"
@echo ""
@for d in domains/*/domain.py; do \
name=$$(basename $$(dirname $$d)); \
if [ "$$name" = "$(DOMAIN)" ]; then \
printf " %-25s <- active\n" "$$name"; \
else \
printf " %-25s\n" "$$name"; \
fi; \
done
@echo ""
@echo "Switch: make setup DOMAIN=<name>"
@echo ""
setup:
@if [ ! -f .env ]; then echo "No .env file. Run: cp .env.example .env"; exit 1; fi
@echo "Setting up $(DOMAIN)..."
@echo ""
@sed -i '' 's/^DEMO_DOMAIN=.*/DEMO_DOMAIN=$(DOMAIN)/' .env
@uv run python scripts/generate_models.py --domain $(DOMAIN)
@uv run python scripts/generate_data.py --domain $(DOMAIN)
@uv run python scripts/flush_redis.py
@sed -i '' 's/^CTX_SURFACE_ID=.*/CTX_SURFACE_ID=/' .env
@sed -i '' 's/^MCP_AGENT_KEY=.*/MCP_AGENT_KEY=/' .env
@uv run python scripts/setup_surface.py --domain $(DOMAIN)
@uv run python scripts/load_data.py --domain $(DOMAIN)
@DEMO_DOMAIN=$(DOMAIN) uv run python -m scripts.seed_memories
@DEMO_DOMAIN=$(DOMAIN) uv run python -m scripts.seed_langcache
@echo ""
@echo "Done. Run 'make dev' to start."
reset:
@echo "Reloading $(DOMAIN)..."
@echo ""
@uv run python scripts/flush_redis.py
@sed -i '' 's/^CTX_SURFACE_ID=.*/CTX_SURFACE_ID=/' .env
@sed -i '' 's/^MCP_AGENT_KEY=.*/MCP_AGENT_KEY=/' .env
@uv run python scripts/setup_surface.py --domain $(DOMAIN)
@uv run python scripts/load_data.py --domain $(DOMAIN)
@DEMO_DOMAIN=$(DOMAIN) uv run python -m scripts.seed_memories
@DEMO_DOMAIN=$(DOMAIN) uv run python -m scripts.seed_langcache
@echo ""
@echo "Done. Run 'make dev' to start."
# --- Individual steps ---
backend-install:
@uv sync
frontend-install:
@cd frontend && npm install
install: backend-install frontend-install
generate-models:
@uv run python scripts/generate_models.py --domain $(DOMAIN)
generate-data:
@uv run python scripts/generate_data.py --domain $(DOMAIN)
load-data:
@uv run python scripts/load_data.py --domain $(DOMAIN)
setup-surface:
@uv run python scripts/setup_surface.py --domain $(DOMAIN)
validate-domain:
@uv run python scripts/validate_domain.py --domain $(DOMAIN)
smoke-domain:
@uv run python scripts/smoke_domain.py --domain $(DOMAIN)
create-domain:
@uv run python scripts/create_domain.py $(DOMAIN)
backend:
@uv run uvicorn backend.app.main:app --reload --host $(BACKEND_HOST) --port $(BACKEND_PORT)
frontend:
@cd frontend && npm run dev -- --host 0.0.0.0 --port $(FRONTEND_PORT)
flush-redis:
@uv run python scripts/flush_redis.py
seed-memories:
@DEMO_DOMAIN=$(DOMAIN) uv run python -m scripts.seed_memories
seed-langcache:
@DEMO_DOMAIN=$(DOMAIN) uv run python -m scripts.seed_langcache
seed-all: seed-memories seed-langcache
dev:
@lsof -ti:$(BACKEND_PORT) | xargs kill -9 2>/dev/null || true
@lsof -ti:$(FRONTEND_PORT) | xargs kill -9 2>/dev/null || true
@sleep 0.5
@trap 'kill 0' EXIT; $(MAKE) backend & $(MAKE) frontend & wait