xonecas.io
60255
Zn

Zoea-Nova / files

Zoea-Nova / Makefile

1.2 KB
1.PHONY: fmt build run test test-integration install clean db-reset-accounts check-upstream-version mcp_client
2
3VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
4LDFLAGS := -ldflags "-X main.Version=$(VERSION)"
5DB_PATH ?= $(HOME)/.zoea-nova/zoea.db
6ACCOUNTS_EXPORT ?= accounts-backup.sql
7
8fmt:
9	go fmt ./...
10
11build:
12	go build $(LDFLAGS) -o bin/zoea ./cmd/zoea
13
14run: build
15	./bin/zoea
16
17install: build
18	mkdir -p $(HOME)/.zoea-nova/bin
19	cp bin/zoea $(HOME)/.zoea-nova/bin/zoea
20
21test:
22	go test -race -timeout=60s -coverprofile=coverage.out ./internal/**
23	go tool cover -func=coverage.out
24	@echo ""
25	@echo "package coverage:"
26	@go tool cover -func=coverage.out | grep "^total:"
27
28clean:
29	rm -rf bin/ coverage.out
30
31db-reset-accounts:
32	mkdir -p $(HOME)/.zoea-nova
33	test -f $(DB_PATH) && sqlite3 $(DB_PATH) "SELECT 'INSERT INTO accounts (username, password) VALUES (' || quote(username) || ',' || quote(password) || ');' FROM accounts;" > $(ACCOUNTS_EXPORT) || true
34	rm -f $(DB_PATH) $(DB_PATH)-shm $(DB_PATH)-wal
35	sqlite3 $(DB_PATH) < internal/store/schema.sql
36	test -s $(ACCOUNTS_EXPORT) && sqlite3 $(DB_PATH) < $(ACCOUNTS_EXPORT) || true
37
38mcp_client:
39	go build -o bin/mcp_client ./cmd/mcp_client
40	./bin/mcp_client