Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
156 lines (121 loc) · 6.24 KB
/
Copy pathMakefile
File metadata and controls
156 lines (121 loc) · 6.24 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
BINARY := distill
GO := go
GOFLAGS :=
LDFLAGS := -s -w
BUILD_DIR := .
.DEFAULT_GOAL := build
# ── Build ─────────────────────────────────────────────────────────────────────
.PHONY: build
build: ## Build the distill binary
$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY) .
.PHONY: install
install: ## Install distill to $GOPATH/bin
$(GO) install $(GOFLAGS) -ldflags "$(LDFLAGS)" .
.PHONY: clean
clean: ## Remove build artifacts
rm -f $(BUILD_DIR)/$(BINARY)
# ── Test ──────────────────────────────────────────────────────────────────────
.PHONY: test
test: ## Run all tests
$(GO) test ./...
.PHONY: test-verbose
test-verbose: ## Run all tests with verbose output
$(GO) test -v ./...
.PHONY: test-race
test-race: ## Run tests with race detector
$(GO) test -race ./...
.PHONY: test-cover
test-cover: ## Run tests and show coverage
$(GO) test -coverprofile=coverage.out ./...
$(GO) tool cover -func=coverage.out
rm -f coverage.out
.PHONY: distill-lock-demo
distill-lock-demo: ## Build, verify, repeat, and mutate the Distill Lock v0 fixture
$(GO) test ./pkg/lock -run '^TestDistillLockDemo$$' -count=1 -v
.PHONY: handoff-v0-demo
handoff-v0-demo: ## Prepare and verify the offline review-only Handoff v0 alpha fixtures
$(GO) test ./pkg/handoff -run '^(TestGoldenReviewFixture|TestHandoffDemo)$$' -count=1 -v
.PHONY: distill-jev-pilot
distill-jev-pilot: ## Generate and validate the excluded offline research pilot
$(GO) run ./cmd/distill-jev-pilot prepare --output build/pilot
$(GO) run ./cmd/distill-jev-pilot validate build/pilot
$(GO) run ./cmd/distill-jev-pilot summarize build/pilot
@printf '%s\n' 'provider_calls=0 final_study_eligible=false'
.PHONY: distill-jev-final
distill-jev-final: ## Generate and validate the offline final-study package
mkdir -p build
chmod 700 build
$(GO) run ./cmd/distill-jev-final prepare \
--output build/final-study \
--agenttrace-contamination-artifact research/context-is-a-build-artifact/final-contamination-ledger-v1.md \
--agenttrace-contamination-sha256 fa2bb7022b30d043d1cabba085253190dba94dd0b85eed98a9cc4fa5e23d0c19
$(GO) run ./cmd/distill-jev-final validate --input build/final-study
$(GO) run ./cmd/distill-jev-final summarize --input build/final-study
@printf '%s\n' 'provider_calls=0 execution_authorized=false'
.PHONY: distill-local-context-control
distill-local-context-control: ## Generate and validate the offline local context-control package
rm -rf build/local-context-control
$(GO) run ./cmd/distill-local-context-control prepare --output build/local-context-control
$(GO) run ./cmd/distill-local-context-control validate --input build/local-context-control
$(GO) run ./cmd/distill-local-context-control summarize --input build/local-context-control
@printf '%s\n' 'provider_calls=0 local_observations=0 execution_authorized=false held_out_records=0'
.PHONY: distill-local-context-control-v2
distill-local-context-control-v2: ## Generate and validate the offline local context-control v2 package
rm -rf build/local-context-control-v2
$(GO) run ./cmd/distill-local-context-control-v2 prepare --output build/local-context-control-v2
$(GO) run ./cmd/distill-local-context-control-v2 validate --input build/local-context-control-v2
$(GO) run ./cmd/distill-local-context-control-v2 summarize --input build/local-context-control-v2
$(GO) run ./cmd/distill-local-context-control-v2 validate-public --input research/context-is-a-build-artifact
@printf '%s\n' 'provider_calls=0 local_observations=0 execution_authorized=false held_out_records=0'
.PHONY: bench
bench: ## Run benchmarks
$(GO) test -bench=. -benchmem ./...
# ── Code quality ──────────────────────────────────────────────────────────────
.PHONY: fmt
fmt: ## Format all Go source files
$(GO) fmt ./...
.PHONY: vet
vet: ## Run go vet
$(GO) vet ./...
.PHONY: lint
lint: ## Run golangci-lint (requires golangci-lint in PATH)
golangci-lint run ./...
.PHONY: check
check: fmt vet test ## Run fmt, vet, and test
# ── Docker ────────────────────────────────────────────────────────────────────
.PHONY: docker-build
docker-build: ## Build the Docker image
docker build -t $(BINARY):latest .
.PHONY: docker-run
docker-run: ## Run the Docker container (API mode, port 8080)
docker run --rm -p 8080:8080 \
-e OPENAI_API_KEY="$$OPENAI_API_KEY" \
$(BINARY):latest api
# ── Release ───────────────────────────────────────────────────────────────────
.PHONY: release-dry
release-dry: ## Dry-run goreleaser (snapshot, no publish)
goreleaser release --snapshot --clean
./scripts/validate-release.sh
.PHONY: release
release: ## Run goreleaser (requires GITHUB_TOKEN)
goreleaser release --clean
# ── Dev helpers ───────────────────────────────────────────────────────────────
.PHONY: config-init
config-init: build ## Generate a default distill.yaml
./$(BINARY) config init
.PHONY: run-api
run-api: build ## Start the API server on :8080
./$(BINARY) api
.PHONY: run-serve
run-serve: build ## Start the serve command
./$(BINARY) serve
.PHONY: deps
deps: ## Download and tidy Go modules
$(GO) mod download
$(GO) mod tidy
# ── Help ──────────────────────────────────────────────────────────────────────
.PHONY: help
help: ## List all available targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' \
| sort