Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
117 lines (88 loc) · 3.39 KB
/
Copy pathMakefile
File metadata and controls
117 lines (88 loc) · 3.39 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
BINARY := kendaliai
CMD := ./cmd/kendaliai
BUILD_DIR := ./build
UI_DIR := ./ui
VERSION := $(shell cat VERSION 2>/dev/null || echo "0.2.0")
# Tools resolution
PM := $(shell command -v bun 2>/dev/null || echo "npm")
AIR := $(shell command -v air 2>/dev/null || echo "$$(go env GOPATH)/bin/air")
.PHONY: all build build-go build-ui dev dev-go dev-ui start start-daemon stop restart status desktop check-computer clean lint tidy install air-install bump-version ui-deps find-agent
all: build
# ── Build Targets ──
ui-deps:
@if [ ! -d "$(UI_DIR)/node_modules" ]; then \
echo "📦 Installing UI dependencies with $(PM)..."; \
cd $(UI_DIR) && $(PM) install; \
fi
build: build-ui build-go
@echo "✅ KendaliAI full build complete: $(BUILD_DIR)/$(BINARY)"
build-go:
@mkdir -p $(BUILD_DIR)
GOWORK=off go build -o $(BUILD_DIR)/$(BINARY) $(CMD)
build-ui: ui-deps
@echo "📦 Building React Vite UI with $(PM)..."
@cd $(UI_DIR) && $(PM) run build
# ── Development Targets (Live Hot-Reload) ──
# Full-stack dev mode: Air (Go live-reload :8080) + Vite (UI live-reload :5173)
dev: ui-deps
@echo "🚀 Starting KendaliAI Full-Stack Dev (Air + Vite)..."
@$(BUILD_DIR)/$(BINARY) stop >/dev/null 2>&1 || true
@trap 'kill 0' EXIT; $(AIR) & (cd $(UI_DIR) && $(PM) run dev)
# Backend only with Air live-reload
dev-go:
@echo "🔥 Starting Go backend with Air live-reloading..."
@$(BUILD_DIR)/$(BINARY) stop >/dev/null 2>&1 || true
@$(AIR)
# Frontend only with Vite hot-reload
dev-ui: ui-deps
@echo "⚡ Starting React Vite frontend..."
@cd $(UI_DIR) && $(PM) run dev
air-install:
go install github.com/air-verse/air@latest
# ── Production Runtime Targets ──
# Start gateway in foreground (auto-clears port 8080 and stale processes first)
start: build-go
$(BUILD_DIR)/$(BINARY) start
# Start gateway in background as daemon
start-daemon: build-go
$(BUILD_DIR)/$(BINARY) start -d
# Stop gateway, kill any process holding port 8080, and clear PID file
stop: build-go
$(BUILD_DIR)/$(BINARY) stop
# Restart gateway daemon
restart: build-go
$(BUILD_DIR)/$(BINARY) restart
# Show gateway status, uptime, PID, and port listeners
status: build-go
$(BUILD_DIR)/$(BINARY) status
# ── Desktop Mode ──
# The binary itself is the desktop app: it serves the chat UI and ships the
# computer-use tools (open apps, type, click, screenshot). This target builds
# UI + server, starts the daemon, and opens the chat window.
desktop: build
$(BUILD_DIR)/$(BINARY) restart >/dev/null 2>&1 || $(BUILD_DIR)/$(BINARY) start -d
@printf 'Waiting for gateway'; \
for i in $$(seq 1 30); do \
if curl -sf http://localhost:8080/health >/dev/null 2>&1; then break; fi; \
printf '.'; sleep 0.5; \
done; echo ' ready'
@open http://localhost:8080
# Verify the computer-use layer of this machine (bpclick, AX permission, capture)
check-computer: build-go
go test ./internal/computer/ -run TestProbe -v -timeout 180s
# Find and detect all installed ACP & external coding agents on this machine
find-agent:
@./scripts/find-agent.sh
# ── Maintenance & Code Quality ──
clean:
rm -rf $(BUILD_DIR)
rm -rf $(UI_DIR)/dist
rm -rf tmp/
tidy:
go mod tidy
lint:
go vet ./internal/... ./cmd/...
bump-version:
@python3 -c "v='$(VERSION)'.split('.'); print('.'.join([v[0],v[1],str(int(v[2])+1)]))" > VERSION && echo "Version bumped to $$(cat VERSION)"
install: build
@$(BUILD_DIR)/$(BINARY) install $(if $(DIR),-d $(DIR),)