-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
117 lines (92 loc) · 4.65 KB
/
Copy pathMakefile
File metadata and controls
117 lines (92 loc) · 4.65 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
.PHONY: help build run test test-cover test-e2e test-tool skill-test loop-test clean up up-devtools up-dashboard down logs shell lint fmt
.DEFAULT_GOAL := help
BINARY_NAME=ghost
GHOSTCTL_NAME=ghostctl
TOOLCLI_NAME=tool-cli
SKILLCLI_NAME=skill-cli
LOOPCLI_NAME=loop-cli
ARTIFACTCLI_NAME=artifact-cli
ARTIFACTSRV_NAME=artifact-server
BUILD_DIR=bin
GO=go
GOFLAGS=-trimpath
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS=-ldflags "-s -w -X main.version=$(VERSION)"
# Local dev: docker/docker-compose.yml (idle Ghost + Postgres + dashboard + toolbox-devtools; no WORLD= selector).
DC := docker compose -f docker/docker-compose.yml
# Vite dev (`make up-dashboard`). Docker dashboard container publishes :5173; avoid clashing.
DASHBOARD_DEV_PORT ?= 5174
help: ## Show available targets
@grep -hE '^[a-zA-Z0-9_-]+:.*?##' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
build: ## Build all binaries (ghost, ghostctl, tool-cli, skill-cli, loop-cli, artifact-cli, artifact-server)
$(GO) build $(GOFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/ghost
$(GO) build $(GOFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/$(GHOSTCTL_NAME) ./cmd/ghostctl
$(GO) build $(GOFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/$(TOOLCLI_NAME) ./cmd/tool-cli
$(GO) build $(GOFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/$(SKILLCLI_NAME) ./cmd/skill-cli
$(GO) build $(GOFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/$(LOOPCLI_NAME) ./cmd/loop-cli
$(GO) build $(GOFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/$(ARTIFACTCLI_NAME) ./cmd/artifact-cli
$(GO) build $(GOFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/$(ARTIFACTSRV_NAME) ./cmd/artifact-server
run: build ## Build and run ghost
$(BUILD_DIR)/$(BINARY_NAME)
test: ## Run tests with race detector
$(GO) test ./... -v -race -count=1
test-cover: ## Run tests with coverage report
$(GO) test ./... -race -coverprofile=coverage.out -covermode=atomic
$(GO) tool cover -func=coverage.out
test-e2e: ## Run E2E toolbox tests (TOOLBOX_MANIFEST=path, TOOLBOX_REMOTE_URL=url)
$(GO) test -tags=e2e ./internal/toolbox/ -v -count=1 -timeout=300s
DC_CI = docker compose -p gis-ci -f docker/ci-tool-test.yml
test-tool: build ## Run integration tests locally (smoke + toolchain + cursor-agent + repo-git)
$(DC_CI) up --build -d
@echo "Waiting for services to be healthy…"
@for i in $$(seq 1 60); do \
curl -sf http://localhost:9091/healthz >/dev/null 2>&1 && \
curl -sf http://localhost:2370/healthz >/dev/null 2>&1 && \
echo "Services healthy after $${i}s" && exit 0; \
sleep 1; \
done; echo "Timed out waiting for healthcheck"; $(DC_CI) logs; $(DC_CI) down -v; exit 1
@$(BUILD_DIR)/$(TOOLCLI_NAME) test \
--manifest $(or $(MANIFEST),toolbox/devtools/toolbox.yaml) \
--remote http://localhost:9091 --verbose && \
./scripts/tests/test-toolchain.sh --remote http://localhost:9091 && \
./scripts/tests/test-cursor-agent.sh --remote http://localhost:9091 && \
./scripts/tests/test-repo-reseed.sh && \
./scripts/tests/test-repo-git.sh \
--remote http://localhost:9091 \
--repo test-business \
--artifact-api http://localhost:2370; \
EXIT=$$?; [ $$EXIT -ne 0 ] && $(DC_CI) logs; $(DC_CI) down -v; exit $$EXIT
skill-test: build ## Smoke-test skills via LLM (SKILLS_DIR=path, PROVIDER=gemini|openai|anthropic)
$(BUILD_DIR)/$(SKILLCLI_NAME) test --skills-dir $(or $(SKILLS_DIR),architect/skills) --provider $(or $(PROVIDER),gemini)
LOOP_WORLD ?= architect/worlds/world9-bizs
LOOP_ARCHETYPE ?= architect/worlds/world9-bizs/archetype/business-manager
LOOP_SNAPSHOT ?= tests-data/loop/snapshot-todo.json
loop-test: build ## Test Ghost Whisper on a snapshot (LOOP_WORLD, LOOP_ARCHETYPE, LOOP_SNAPSHOT, PROVIDER)
$(BUILD_DIR)/$(LOOPCLI_NAME) whisper \
--world $(LOOP_WORLD) \
--archetype $(LOOP_ARCHETYPE) \
--snapshot $(LOOP_SNAPSHOT) \
--provider $(or $(PROVIDER),gemini) \
--verbose
lint: ## Run golangci-lint
golangci-lint run ./...
fmt: ## Format code (go fmt + goimports)
$(GO) fmt ./...
goimports -w .
clean: ## Remove build artifacts
rm -rf $(BUILD_DIR)
up: ## Start local stack (docker/docker-compose.yml): ghost-db, ghost, dashboard, toolbox-devtools
$(DC) up --build
up-devtools: ## Start only toolbox-devtools (local compose)
$(DC) up --build -d toolbox-devtools
up-dashboard: ## Run GIS dashboard (Vite dev on :5174; Docker dashboard uses :5173). DASHBOARD_DEV_PORT=…
cd dashboard && npm install && npm run dev -- --port $(DASHBOARD_DEV_PORT)
down: ## Stop local stack (docker/docker-compose.yml)
$(DC) down
logs: ## Tail local stack logs
$(DC) logs -f
shell: ## Exec into a local container (SVC=ghost|toolbox-devtools)
$(DC) exec $(or $(SVC),ghost) bash
ifneq ($(wildcard makefiles/world9.mk),)
include makefiles/world9.mk
endif