-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
148 lines (116 loc) · 5.87 KB
/
Makefile
File metadata and controls
148 lines (116 loc) · 5.87 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
# Java Chat Makefile
# See config/make/common.mk for shared variables and functions
include config/make/common.mk
.PHONY: all help clean build test 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 update-github-repos 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
$(GRADLEW) clean
build: frontend-build ## Build the project (skip tests)
$(GRADLEW) build -x test
test: ## Run tests (loads .env if present)
@$(call load_env); \
$(GRADLEW) test
lint: lint-ast lint-frontend ## Run static analysis (Java + Frontend)
$(GRADLEW) spotbugsMain pmdMain
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)
@echo "$(CYAN)Running ast-grep rules...$(NC)"
@ast-grep scan -c config/sgconfig.yml src/main/java/
format: ## Apply Java formatting (Palantir via Spotless)
$(GRADLEW) spotlessApply
hooks: ## Install git hooks via prek
@$(call require_cmd,prek,https://prek.j178.dev/)
prek install --install-hooks -c config/prek.toml
run: build ## Run the packaged jar (loads .env if present)
@$(call load_env); \
$(call validate_api_keys); \
SERVER_PORT=$$($(call get_server_port)); \
echo "Ensuring port $$SERVER_PORT is free..." >&2; \
$(call free_port,$$SERVER_PORT); \
echo "Binding app to port $$SERVER_PORT" >&2; \
$(call build_app_args,$$SERVER_PORT); \
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 (Ctrl+C stops both)
@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); \
trap 'kill 0' INT TERM; \
(cd frontend && npm run dev 2>&1 | awk '{print "\033[36m[vite]\033[0m " $$0; fflush()}') & \
($(call load_env); \
$(call build_app_args,$(DEFAULT_PORT)); \
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 "Ensuring ports $$SERVER_PORT and $$LIVERELOAD_PORT are free..." >&2; \
$(call free_port,$$SERVER_PORT); \
$(call free_port,$$LIVERELOAD_PORT); \
echo "Binding app (dev) to port $$SERVER_PORT, LiveReload on $$LIVERELOAD_PORT" >&2; \
$(call build_app_args,$$SERVER_PORT); \
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: frontend-install ## Build frontend for production
cd frontend && npm run build
compose-up: ## Start local Qdrant via Docker Compose (detached)
@for p in 8086 8087; do \
$(call free_port,$$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
update-github-repos: ## Check all GitHub repo collections for updates and re-ingest changed ones
./scripts/update_all_github_repos.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!"