-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
113 lines (99 loc) · 3.61 KB
/
Copy pathMakefile
File metadata and controls
113 lines (99 loc) · 3.61 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
# Makefile for spacemolt-agent-server
#
# IMPORTANT: Use 'make build' to compile binaries.
# Do NOT run 'go build ./...' directly - it creates binaries in the root directory
# which should be kept clean. All binaries go into ./bin/
.PHONY: test test-race lint vet check-all clean build update-server-docs generate-mcp-tools update-mcp
# Run standard tests
test:
@echo "Running tests..."
go test -v ./...
# Run tests with race detector
test-race:
@echo "Running tests with race detector..."
go test -race -timeout=5m ./...
# Run golangci-lint
lint:
@echo "Running golangci-lint..."
@if command -v golangci-lint >/dev/null 2>&1; then \
golangci-lint run ./...; \
else \
echo "golangci-lint not found. Install with:"; \
echo " curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b \$$(go env GOPATH)/bin"; \
exit 1; \
fi
# Run go vet
vet:
@echo "Running go vet..."
go vet ./...
# Run staticcheck if available
staticcheck:
@echo "Running staticcheck..."
@if command -v staticcheck >/dev/null 2>&1; then \
staticcheck ./...; \
else \
echo "staticcheck not found. Install with:"; \
echo " go install honnef.co/go/tools/cmd/staticcheck@latest"; \
fi
# Run all checks
check-all: vet lint staticcheck test-race
@echo ""
@echo "================================"
@echo "All checks passed!"
@echo "================================"
# Build all binaries
build:
@echo "Building binaries..."
go build -o bin/spacemolt-server ./cmd/spacemolt-server
go build -o bin/auto-explorer ./cmd/auto-explorer
go build -o bin/auto-prophet ./cmd/auto-prophet
go build -o bin/overmind ./cmd/overmind
go build -o bin/worker ./cmd/worker
go build -o bin/overmind-status ./cmd/tools/overmind-status
@echo "Binaries built in ./bin/"
# Build with race detector (for development/testing)
build-race:
@echo "Building with race detector..."
go build -race -o bin/spacemolt-server-race ./cmd/spacemolt-server
go build -race -o bin/overmind-race ./cmd/overmind
go build -race -o bin/worker-race ./cmd/worker
@echo "Race-detecting binaries built in ./bin/"
# Clean build artifacts
clean:
@echo "Cleaning..."
rm -rf bin/
go clean -testcache
# Show race detector usage help
help-race:
@echo "Race Detector Usage:"
@echo ""
@echo " make test-race - Run all tests with race detector"
@echo " make build-race - Build binaries with race detector for manual testing"
@echo " go test -race ./... - Run tests with race detection"
@echo " go run -race main.go - Run program with race detection"
@echo ""
@echo "Note: Race detector adds ~5-10x overhead (slower, more memory)"
@echo " Use only for testing, not production"
# Update server documentation from spacemolt.com
update-server-docs:
@echo "Fetching latest API documentation from spacemolt.com..."
go run ./cmd/update-server-docs
# Generate MCP tools from OpenAPI spec
generate-mcp-tools:
@echo "Generating MCP tool definitions from OpenAPI spec..."
go run ./cmd/generate-mcp-tools
# Update MCP bridge with latest API (fetch docs + regenerate tools)
update-mcp: update-server-docs generate-mcp-tools
@echo ""
@echo "================================"
@echo "MCP bridge updated successfully!"
@echo "================================"
@echo ""
@echo "Changes:"
@echo " - server_docs/openapi.json updated from game server"
@echo " - cmd/mcp-ws-bridge/tools_generated.go regenerated"
@echo ""
@echo "Next steps:"
@echo " 1. Review changes: git diff server_docs/ cmd/mcp-ws-bridge/"
@echo " 2. Test bridge: make test"
@echo " 3. Commit if satisfied: git add -A && git commit -m 'chore: update MCP tools from latest API'"