-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (58 loc) · 3.32 KB
/
Copy pathMakefile
File metadata and controls
78 lines (58 loc) · 3.32 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
.PHONY: install run init dashboard costs costs-today costs-week seed-costs stop logs help memory-server memory-server-stop memory-dump memory-import memory-reset
LABEL ?= hcc-ai-framework
CONTAINER_RT ?= $(shell command -v docker 2>/dev/null && echo docker || echo podman)
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
install: ## Install dependencies with uv
uv sync
init: install ## Full setup: install deps, LSP, memory server
./init.sh
dashboard: ## Build the dashboard UI
cd dashboard && npm run build
run: ## Run the bot (LABEL=hcc-ai-framework by default)
uv run dev-bot --label $(LABEL)
run-rbac: ## Run the bot with platform-accessmanagement label
uv run dev-bot --label hcc-ai-platform-accessmanagement
stop: ## Stop a running bot (release lock)
@if [ -f data/.lock ]; then \
pid=$$(cat data/.lock 2>/dev/null); \
if [ -n "$$pid" ] && kill -0 "$$pid" 2>/dev/null; then \
kill "$$pid" && echo "Stopped bot (PID $$pid)"; \
else \
rm -f data/.lock && echo "Removed stale lock"; \
fi \
else \
echo "No bot running"; \
fi
logs: ## Tail bot log
tail -f data/bot.log
costs: ## Show all cost data
./costs.sh all
costs-today: ## Show today's costs
./costs.sh today
costs-week: ## Show this week's costs
./costs.sh week
seed-costs: ## Import costs.jsonl into the database
uv run python scripts/seed-costs.py data/costs.jsonl
memory-server: ## Start memory server + postgres
$(CONTAINER_RT) compose -f memory-server/docker-compose.yml up --build
memory-server-stop: ## Stop memory server + postgres
$(CONTAINER_RT) compose -f memory-server/docker-compose.yml down
memory-dump: ## Dump memory DB to data/memory-dump.sql
@($(CONTAINER_RT) compose exec -T postgres pg_dump -U bot --data-only --inserts --on-conflict-do-nothing bot_memory 2>/dev/null || \
$(CONTAINER_RT) compose -f memory-server/docker-compose.yml exec -T postgres pg_dump -U bot --data-only --inserts --on-conflict-do-nothing bot_memory) > data/memory-dump.sql
@echo "Dumped to data/memory-dump.sql"
memory-import: ## Import data from data/memory-dump.sql (additive, skips duplicates)
@$(CONTAINER_RT) compose exec -T postgres psql -U bot -d bot_memory < data/memory-dump.sql 2>/dev/null || \
$(CONTAINER_RT) compose -f memory-server/docker-compose.yml exec -T postgres psql -U bot -d bot_memory < data/memory-dump.sql
@echo "Imported from data/memory-dump.sql"
memory-reset: ## Wipe and reimport memory DB from data/memory-dump.sql
@($(CONTAINER_RT) compose exec -T postgres psql -U bot -d bot_memory -c "DELETE FROM bot_status; DELETE FROM cycles; DELETE FROM memories; DELETE FROM tasks;" 2>/dev/null || \
$(CONTAINER_RT) compose -f memory-server/docker-compose.yml exec -T postgres psql -U bot -d bot_memory -c "DELETE FROM bot_status; DELETE FROM cycles; DELETE FROM memories; DELETE FROM tasks;") && \
($(CONTAINER_RT) compose exec -T postgres psql -U bot -d bot_memory < data/memory-dump.sql 2>/dev/null || \
$(CONTAINER_RT) compose -f memory-server/docker-compose.yml exec -T postgres psql -U bot -d bot_memory < data/memory-dump.sql)
@echo "Reset and imported from data/memory-dump.sql"
docker-up: ## Start full stack (postgres + memory server + bot)
$(CONTAINER_RT) compose up --build
docker-down: ## Stop full stack
$(CONTAINER_RT) compose down