-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
175 lines (140 loc) · 7.22 KB
/
Copy pathMakefile
File metadata and controls
175 lines (140 loc) · 7.22 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# Java Chat Makefile
# See config/make/common.mk for shared variables and functions
include config/make/common.mk
.PHONY: all help clean build test test-shell test-qdrant-integration lint lint-ast lint-frontend format hooks run dev dev-backend compose-up compose-down compose-logs compose-ps health ingest citations fetch-all fetch-force fetch-quick process-all process-doc-sets process-github-repo full-pipeline frontend-install frontend-build
all: help ## Default target (alias)
help: ## Show available targets
@grep -E '^[a-zA-Z0-9_.-]+:.*?## ' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-16s\033[0m %s\n", $$1, $$2}'
clean: ## Clean build outputs
$(LOCKED_GRADLEW) clean
build: ## Build the project (skip tests)
./scripts/with_build_state_lock.sh $(MAKE) build-with-lock
build-with-lock: frontend-build-with-lock
$(GRADLEW) build -x test
test: test-shell ## Run tests (loads .env if present)
@$(call load_env); \
$(LOCKED_GRADLEW) --no-daemon cleanTest test
test-shell: ## Run deterministic ingestion and fetch shell contract tests
bash scripts/test_documentation_fetch_projection.sh
bash scripts/test_documentation_fetch_publication.sh
bash scripts/test_embedding_preflight.sh
bash scripts/test_github_sync_failure_contract.sh
bash scripts/test_ingestion_pid_safety.sh
bash scripts/test_make_local_qdrant_bootstrap.sh
bash scripts/test_make_port_safety.sh
bash scripts/test_process_all_to_qdrant_environment.sh
bash scripts/test_process_all_to_qdrant_postconditions.sh
bash scripts/test_prune_retired_java_api_vectors.sh
test-qdrant-integration: ## Run synthetic hybrid-contract checks against local Qdrant 1.18.3
bash scripts/test_qdrant_1_18_integration.sh
lint: lint-ast lint-frontend ## Run static analysis (Java + Frontend)
$(LOCKED_GRADLEW) spotbugsMain spotbugsTest pmdMain pmdTest
lint-frontend: ## Run frontend linting (oxlint + ast-grep + svelte-check)
cd frontend && npm run lint && npm run check
lint-ast: ## Run ast-grep rules for Java naming and type safety
@$(call require_cmd,ast-grep,brew install ast-grep)
@$(call require_cmd,ruby,brew install ruby)
@echo "$(CYAN)Running ast-grep rules...$(NC)"
@ast-grep test -c config/sgconfig.yml --skip-snapshot-tests
@ast-grep scan -c config/sgconfig.yml src/main/java/
@ruby scripts/lint/check-chat-model-ssot.rb --self-test
@ruby scripts/lint/check-chat-model-ssot.rb
format: ## Apply Java formatting (Palantir via Spotless)
$(LOCKED_GRADLEW) spotlessApply
hooks: ## Install git hooks via lefthook
@$(call require_cmd,lefthook,brew install lefthook)
lefthook install -f
run: build ## Run the packaged jar (loads .env if present)
@$(call load_env); \
$(call validate_api_keys); \
SERVER_PORT=$$($(call get_server_port)); \
echo "Checking whether port $$SERVER_PORT is available..." >&2; \
$(call require_port_available,$$SERVER_PORT); \
echo "Binding app to port $$SERVER_PORT" >&2; \
$(call build_app_args,$$SERVER_PORT); \
$(call append_local_qdrant_bootstrap_argument); \
JAVA_OPTS="$${JAVA_OPTS:- $(DEFAULT_JAVA_OPTS)}"; \
java $$JAVA_OPTS -Djava.net.preferIPv4Stack=true -jar $(call get_jar) "$${APP_ARGS[@]}" & disown
dev: frontend-build ## Start both Spring Boot and Vite dev servers
@echo "$(YELLOW)Starting full-stack development environment...$(NC)"
@echo "$(CYAN)Frontend: http://localhost:5173/$(NC)"
@echo "$(YELLOW)Backend API: http://localhost:$(DEFAULT_PORT)/api/$(NC)"
@echo ""
@$(call load_env); \
$(call validate_api_keys); \
SERVER_PORT=$(DEFAULT_PORT); \
echo "Checking whether port $$SERVER_PORT is available..." >&2; \
$(call require_port_available,$$SERVER_PORT); \
(cd frontend && npm run dev 2>&1 | awk '{print "\033[36m[vite]\033[0m " $$0; fflush()}') & \
($(call load_env); \
$(call build_app_args,$$SERVER_PORT); \
$(call append_local_qdrant_bootstrap_argument); \
SPRING_PROFILES_ACTIVE=dev $(GRADLEW) bootRun \
--args="$${APP_ARGS[*]}" \
-Dorg.gradle.jvmargs="$(GRADLE_JVM_ARGS)" 2>&1 \
| awk '{print "\033[33m[java]\033[0m " $$0; fflush()}') & \
wait
dev-backend: ## Run only Spring Boot backend (dev profile)
@$(call load_env); \
$(call validate_api_keys); \
SERVER_PORT=$$($(call get_server_port)); \
LIVERELOAD_PORT=$${LIVERELOAD_PORT:-$(DEFAULT_LIVERELOAD_PORT)}; \
echo "Checking whether ports $$SERVER_PORT and $$LIVERELOAD_PORT are available..." >&2; \
$(call require_port_available,$$SERVER_PORT); \
$(call require_port_available,$$LIVERELOAD_PORT); \
echo "Binding app (dev) to port $$SERVER_PORT, LiveReload on $$LIVERELOAD_PORT" >&2; \
$(call build_app_args,$$SERVER_PORT); \
$(call append_local_qdrant_bootstrap_argument); \
APP_ARGS+=(--spring.devtools.livereload.port=$$LIVERELOAD_PORT); \
SPRING_PROFILES_ACTIVE=dev $(GRADLEW) bootRun \
--args="$${APP_ARGS[*]}" \
-Dorg.gradle.jvmargs="$(GRADLE_JVM_ARGS)"
frontend-install: ## Install frontend dependencies
cd frontend && npm install
frontend-build: ## Build frontend for production
./scripts/with_build_state_lock.sh $(MAKE) frontend-build-with-lock
frontend-build-with-lock: frontend-install
cd frontend && npm run build
compose-up: ## Start local Qdrant via Docker Compose (detached)
@for p in 8086 8087; do \
$(call require_port_available,$$p); \
done; \
docker compose -f $(QDRANT_COMPOSE_FILE) up -d
compose-down: ## Stop Docker Compose services
docker compose -f $(QDRANT_COMPOSE_FILE) down
compose-logs: ## Tail logs for Docker Compose services
docker compose -f $(QDRANT_COMPOSE_FILE) logs -f
compose-ps: ## List Docker Compose services
docker compose -f $(QDRANT_COMPOSE_FILE) ps
health: ## Check app health endpoint
curl -sS http://localhost:$${PORT:-$(DEFAULT_PORT)}/actuator/health
ingest: ## Ingest first 1000 docs (adjust maxPages=)
curl -sS -X POST "http://localhost:$${PORT:-$(DEFAULT_PORT)}/api/ingest?maxPages=1000"
citations: ## Try a citations lookup
curl -sS "http://localhost:$${PORT:-$(DEFAULT_PORT)}/api/chat/citations?q=records"
fetch-all: ## Fetch all documentation with deduplication
./scripts/fetch_all_docs.sh
fetch-force: ## Fetch all documentation (full refresh; forces refetch)
./scripts/fetch_all_docs.sh --force
fetch-quick: ## Fetch documentation including quick landing mirrors
./scripts/fetch_all_docs.sh --include-quick
process-all: ## Process all docs into Qdrant with deduplication
./scripts/process_all_to_qdrant.sh
process-doc-sets: ## Process selected doc sets into Qdrant (set DOCS_SETS=...)
@if [ -z "$$DOCS_SETS" ]; then echo "Set DOCS_SETS=comma,separated,docsets"; exit 1; fi
./scripts/process_all_to_qdrant.sh --doc-sets="$$DOCS_SETS"
process-github-repo: ## Ingest GitHub repo by local path or URL, or sync existing collections
@if [ -z "$$SYNC_EXISTING" ] && [ -z "$$REPO_URL" ] && [ -z "$$REPO_PATH" ]; then \
echo "Set REPO_PATH=/path/to/repo OR REPO_URL=https://github.com/owner/repo (optionally REPO_CACHE_PATH/REPO_CACHE_DIR) OR SYNC_EXISTING=1"; \
exit 1; \
fi
./scripts/process_github_repo.sh
full-pipeline: ## Complete pipeline: fetch docs, then process into Qdrant
@echo "Starting full documentation pipeline..."
@echo "Step 1: Fetching documentation..."
@./scripts/fetch_all_docs.sh
@echo ""
@echo "Step 2: Processing and uploading to Qdrant..."
@./scripts/process_all_to_qdrant.sh
@echo ""
@echo "Full pipeline complete!"