-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
124 lines (90 loc) · 4.05 KB
/
Makefile
File metadata and controls
124 lines (90 loc) · 4.05 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
.PHONY: all build build-local build-ui build-with-ui test lint fmt vet clean docker-up docker-down ci security tidy \
dev-ui migrate-apply migrate-lint migrate-hash migrate-diff migrate-status migrate-validate \
check-doc-consistency verify-restore reconcile-qdrant reconcile-qdrant-repair \
archive-events-dry-run archive-events verify-exit-criteria install-hooks coverage
BINARY := bin/akashi
GO := go
GOFLAGS := -race
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -ldflags "-X main.version=$(VERSION)"
all: fmt lint vet test build
# Run the full CI pipeline locally (mirrors .github/workflows/ci.yml)
ci: tidy check-doc-consistency build lint vet security test migrate-validate
@echo "CI passed"
check-doc-consistency:
python3 scripts/check_doc_config_consistency.py
build:
$(GO) build $(LDFLAGS) -o $(BINARY) ./cmd/akashi
build-local: ## Build the zero-infra SQLite MCP server (ADR-009)
$(GO) build -tags lite $(LDFLAGS) -o bin/akashi-local ./cmd/akashi-local
# Build the frontend (produces ui/dist/).
build-ui:
cd ui && npm ci && npm run build
# Build the Go binary with the embedded UI.
build-with-ui: build-ui
$(GO) build -tags ui $(LDFLAGS) -o $(BINARY) ./cmd/akashi
# Run the Vite dev server with API proxy to the Go server.
dev-ui:
cd ui && npm run dev
test:
$(GO) test $(GOFLAGS) ./... -v
coverage: ## Run tests with coverage and enforce 50% threshold
$(GO) test $(GOFLAGS) -coverprofile=coverage.out ./...
bash scripts/check_coverage.sh coverage.out 50
# NOTE: CI uses golangci-lint v2.8.0. Install locally with:
# go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.8.0
lint:
golangci-lint run ./...
fmt:
goimports -w .
gofmt -s -w .
vet:
$(GO) vet ./...
security:
govulncheck ./...
tidy:
$(GO) mod tidy
@git diff --quiet go.mod go.sum || (echo "go.mod/go.sum not tidy" && exit 1)
clean:
rm -rf bin/ ui/dist/ ui/node_modules/
$(GO) clean -testcache
docker-up:
docker compose up -d
docker-down:
docker compose down
docker-rebuild:
docker compose up -d --build
# Atlas migration targets.
# Requires: atlas CLI (https://atlasgo.io/getting-started#installation)
# Environment variables:
# DATABASE_URL - target database (default: local PgBouncer)
# ATLAS_DEV_URL - disposable Postgres for diffing/linting (default: local direct)
ATLAS_DEV_URL ?= postgres://akashi:akashi@localhost:5432/akashi?sslmode=disable&search_path=public
ATLAS ?= atlas
migrate-apply: ## Apply pending migrations
$(ATLAS) migrate apply --env local
migrate-lint: ## Lint migration files for safety issues
$(ATLAS) migrate lint --env ci --latest 1
migrate-hash: ## Regenerate atlas.sum after editing migration files
$(ATLAS) migrate hash --dir file://migrations
migrate-diff: ## Generate a new migration from schema changes (usage: make migrate-diff name=add_foo)
@test -n "$(name)" || (echo "usage: make migrate-diff name=<migration_name>" && exit 1)
$(ATLAS) migrate diff $(name) --env local
migrate-status: ## Show migration status
$(ATLAS) migrate status --env local
migrate-validate: ## Validate migration file integrity (checksums + SQL)
$(ATLAS) migrate validate --dir file://migrations
verify-restore: ## Run post-restore DB verification checks (requires DATABASE_URL)
bash scripts/verify_restore.sh
reconcile-qdrant: ## Detect Postgres vs Qdrant drift (requires DATABASE_URL, QDRANT_URL)
python3 scripts/reconcile_qdrant.py
reconcile-qdrant-repair: ## Enqueue missing Postgres decisions into outbox for Qdrant repair
python3 scripts/reconcile_qdrant.py --repair
archive-events-dry-run: ## Archive candidate agent_events window without purging
DRY_RUN=true ENABLE_PURGE=false bash scripts/archive_agent_events.sh
archive-events: ## Archive and purge one retention window (requires explicit flags)
DRY_RUN=false ENABLE_PURGE=true bash scripts/archive_agent_events.sh
verify-exit-criteria: ## Evaluate durability exit criteria (JSON output; non-zero on failure)
python3 scripts/verify_exit_criteria.py
install-hooks: ## Install IDE hooks for Claude Code and Cursor
@bash scripts/install-ide-hooks.sh