-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathMakefile
More file actions
157 lines (129 loc) · 6.89 KB
/
Copy pathMakefile
File metadata and controls
157 lines (129 loc) · 6.89 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
157
.PHONY: all build build-benchmark install test fmt vet lint vuln audit-security jules-list jules-review jules-merge validate validate-examples validate-all check release dist-bundle benchmark clean help sync-assets
BIN := bin/okf
BUNDLE := knowledge
DIST_DIR := dist
VERSION ?= dev
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || echo "unknown")
LDFLAGS := -X main.Version=$(VERSION) -X main.Commit=$(COMMIT) -X main.Date=$(DATE)
RELEASE_LDFLAGS := -s -w $(LDFLAGS)
all: help
## ----------------------------------------------------------------------
## Pipeline & Verification
## ----------------------------------------------------------------------
## check: Run the complete CI/local pipeline (fmt, vet, lint, test, validate-all)
check: fmt vet lint test validate-all
## test: Run all Go unit and integration tests (including dogfood asset drift check)
test:
@go test -v -race ./...
## sync-assets: Synchronize active skill files (.agents/skills/) to embedded bootstrap assets (pkg/okf/assets/skill/)
sync-assets:
@echo "==> Synchronizing dogfooded skills to embedded bootstrap assets..."
@mkdir -p pkg/okf/assets/skill
@cp -R .agents/skills/okf-memory/* pkg/okf/assets/skill/
@echo "==> Done. Embedded assets in pkg/okf/assets/skill/ are now synchronized."
## fmt: Format all Go source files with gofumpt / gofmt
fmt:
@which gofumpt > /dev/null && gofumpt -w -extra . || gofmt -w -s .
## vet: Run go vet static analysis
vet:
@go vet ./...
## lint: Run golangci-lint static analysis (falls back to go vet)
lint:
@which golangci-lint > /dev/null && golangci-lint run ./... || go vet ./...
## audit-security: Run automated security analysis (gosec and govulncheck)
audit-security:
@echo "==> Running security checks..."
@which gosec > /dev/null && gosec -quiet -exclude=G301,G306 -exclude-dir=examples ./... || echo "gosec: optional (install via: go install github.com/securego/gosec/v2/cmd/gosec@latest)"
@which govulncheck > /dev/null && govulncheck ./... || echo "govulncheck: optional (install via: go install golang.org/x/vuln/cmd/govulncheck@latest)"
## vuln: Run govulncheck vulnerability scanner directly
vuln:
@govulncheck ./...
## jules-list: List open Google Jules security audit branches on origin
jules-list:
@./scripts/jules-flow.sh list
## jules-review: Build, test, and review latest or specified Jules branch (BRANCH=<name>) in an isolated worktree
jules-review:
@./scripts/jules-flow.sh review $(BRANCH)
## jules-merge: Merge verified Jules remediation branch into develop (BRANCH=<name>)
jules-merge:
@./scripts/jules-flow.sh merge $(BRANCH)
## ----------------------------------------------------------------------
## Build & OKF Knowledge Validation
## ----------------------------------------------------------------------
## build: Compile the standalone Go CLI and MCP server binary
build:
@mkdir -p bin
@go build -ldflags="$(LDFLAGS)" -o $(BIN) ./cmd/okf
## build-benchmark: Compile bin/okf-benchmark executable
build-benchmark:
@mkdir -p bin
@go build -ldflags="$(LDFLAGS)" -o bin/okf-benchmark ./cmd/okf-benchmark
## install: Install bin/okf to $GOPATH/bin
install:
@go install -ldflags="$(LDFLAGS)" ./cmd/okf
## validate: Run strict OKF v0.2 validation on the knowledge/ bundle
validate: build
@$(BIN) validate $(BUNDLE) --strict --drift
## validate-examples: Validate all bundled example corpora
validate-examples: build
@$(BIN) validate examples/software --strict
@$(BIN) validate examples/coaching --strict
@$(BIN) validate examples/books --strict
## validate-all: Validate project knowledge and all examples
validate-all: validate validate-examples
## ----------------------------------------------------------------------
## Release & Packaging
## ----------------------------------------------------------------------
## release: Cross-compile binaries for macOS, Linux, and Windows
release:
@mkdir -p $(DIST_DIR)/bin
@echo "Building cross-platform binaries (v$(VERSION), commit $(COMMIT))..."
@GOOS=darwin GOARCH=arm64 go build -ldflags="$(RELEASE_LDFLAGS)" -o $(DIST_DIR)/bin/okf-darwin-arm64 ./cmd/okf
@GOOS=darwin GOARCH=amd64 go build -ldflags="$(RELEASE_LDFLAGS)" -o $(DIST_DIR)/bin/okf-darwin-amd64 ./cmd/okf
@GOOS=linux GOARCH=amd64 go build -ldflags="$(RELEASE_LDFLAGS)" -o $(DIST_DIR)/bin/okf-linux-amd64 ./cmd/okf
@GOOS=linux GOARCH=arm64 go build -ldflags="$(RELEASE_LDFLAGS)" -o $(DIST_DIR)/bin/okf-linux-arm64 ./cmd/okf
@GOOS=windows GOARCH=amd64 go build -ldflags="$(RELEASE_LDFLAGS)" -o $(DIST_DIR)/bin/okf-windows-amd64.exe ./cmd/okf
@GOOS=windows GOARCH=arm64 go build -ldflags="$(RELEASE_LDFLAGS)" -o $(DIST_DIR)/bin/okf-windows-arm64.exe ./cmd/okf
@echo "Release binaries built in $(DIST_DIR)/bin/"
## dist-bundle: Package a complete, ready-to-use starter pack archive (.tar.gz and .zip)
dist-bundle: build
@mkdir -p $(DIST_DIR)/okf-starter-pack
@$(BIN) bootstrap $(DIST_DIR)/okf-starter-pack --name "Project"
@mkdir -p $(DIST_DIR)/okf-starter-pack/bin && cp $(BIN) $(DIST_DIR)/okf-starter-pack/bin/okf
@tar -czf $(DIST_DIR)/okf-starter-pack-v$(VERSION).tar.gz -C $(DIST_DIR) okf-starter-pack
@cd $(DIST_DIR) && zip -q -r okf-starter-pack-v$(VERSION).zip okf-starter-pack
@echo "Created $(DIST_DIR)/okf-starter-pack-v$(VERSION).tar.gz and .zip"
## benchmark: Run local LLM progressive disclosure benchmark suite against LM Studio
benchmark:
@go run ./cmd/okf-benchmark $(ARGS)
## clean: Remove compiled binaries and release distributions
clean:
@rm -rf bin $(DIST_DIR)
## help: Display available targets
help:
@echo "OKF Agent Memory Makefile"
@echo ""
@echo "Pipeline:"
@echo " make check Run complete pipeline (fmt, vet, lint, test, validate-all)"
@echo " make test Run Go unit tests"
@echo " make fmt Format code with gofumpt / gofmt"
@echo " make vet Run go vet static analysis"
@echo " make lint Run golangci-lint (fallback: go vet)"
@echo " make audit-security Run automated security audit (gosec, govulncheck)"
@echo " make jules-list List open Jules security branches on origin"
@echo " make jules-review Run isolated build & test of latest Jules branch"
@echo " make jules-merge Merge verified Jules branch into develop"
@echo ""
@echo "Build & Knowledge:"
@echo " make build Compile bin/okf executable"
@echo " make install Install bin/okf to \$$GOPATH/bin"
@echo " make validate Validate knowledge/ bundle (--strict --drift)"
@echo " make validate-examples Validate all example corpora"
@echo " make validate-all Validate knowledge/ and all examples"
@echo ""
@echo "Distribution:"
@echo " make release Cross-compile binaries for macOS, Linux, and Windows"
@echo " make dist-bundle Build starter pack archives (.tar.gz & .zip)"
@echo " make clean Remove build and dist artifacts"
@echo " make help Display this help message"