-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (69 loc) · 2.52 KB
/
Makefile
File metadata and controls
84 lines (69 loc) · 2.52 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
.PHONY: build test test-verbose test-race coverage coverage-html lint clean deps check install calibrate-providers install-hooks help
# Binary name
BINARY=nightshift
PKG=./cmd/nightshift
# Build the binary
build:
go build -o $(BINARY) $(PKG)
# Install the binary to your Go bin directory
install:
go install $(PKG)
@echo "Installed $(BINARY) to $$(if [ -n "$$(go env GOBIN)" ]; then go env GOBIN; else echo "$$(go env GOPATH)/bin"; fi)"
# Run provider calibration comparison tool
calibrate-providers:
go run ./cmd/provider-calibration --repo "$$(pwd)" --codex-originator codex_cli_rs --min-user-turns 2
# Run all tests
test:
go test ./...
# Run tests with verbose output
test-verbose:
go test -v ./...
# Run tests with race detection
test-race:
go test -race ./...
# Run tests with coverage report
coverage:
go test -coverprofile=coverage.out ./...
go tool cover -func=coverage.out
@echo ""
@echo "To view HTML coverage report, run: go tool cover -html=coverage.out"
# Generate HTML coverage report
coverage-html: coverage
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
# Run golangci-lint (if installed)
lint:
@which golangci-lint > /dev/null || (echo "golangci-lint not installed. Run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest" && exit 1)
golangci-lint run
# Clean build artifacts
clean:
rm -f $(BINARY)
rm -f coverage.out
rm -f coverage.html
# Install development dependencies
deps:
go mod download
go mod tidy
# Run all checks (test + lint)
check: test lint
# Show help
help:
@echo "Available targets:"
@echo " build - Build the binary"
@echo " test - Run all tests"
@echo " test-verbose - Run tests with verbose output"
@echo " test-race - Run tests with race detection"
@echo " coverage - Run tests with coverage report"
@echo " coverage-html - Generate HTML coverage report"
@echo " lint - Run golangci-lint"
@echo " clean - Clean build artifacts"
@echo " deps - Download and tidy dependencies"
@echo " check - Run tests and lint"
@echo " install - Build and install to Go bin directory"
@echo " calibrate-providers - Compare local Claude/Codex session usage for calibration"
@echo " install-hooks - Install git pre-commit hook"
@echo " help - Show this help"
# Install git pre-commit hook
install-hooks:
@ln -sf ../../scripts/pre-commit.sh .git/hooks/pre-commit
@echo "✓ pre-commit hook installed (.git/hooks/pre-commit → scripts/pre-commit.sh)"