Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
478 lines (382 loc) · 22.6 KB
/
Copy pathMakefile
File metadata and controls
478 lines (382 loc) · 22.6 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
.PHONY: help server servers client-core client-certificate client-ai client-presentation client-assessment \
client-interview client-matching client-example client-team-allocation \
client-self-team-allocation client-infrastructure-setup clients db db-down \
server-core server-assessment server-interview \
server-team-allocation server-self-team-allocation server-example \
server-certificate server-presentation server-infrastructure-setup server-ai \
lint lint-clients lint-servers \
test test-clients test-core test-assessment test-interview \
test-team-allocation test-self-team-allocation test-example \
test-certificate test-presentation test-infrastructure-setup test-ai \
test-e2e test-e2e-shard test-e2e-ui test-e2e-down \
verify-up verify-down stack stop stack-down s3 \
sqlc sqlc-core sqlc-assessment sqlc-interview \
sqlc-team-allocation sqlc-self-team-allocation sqlc-example \
sqlc-certificate sqlc-presentation sqlc-infrastructure-setup sqlc-ai \
swagger install-clients install-hooks setup-skills new-phase \
seed seed-check
# A linked worktree has no .env or .env.dev of its own (both are gitignored),
# so it falls back to the main checkout's copy of each.
MAIN_CHECKOUT := $(patsubst %/.git,%,$(shell git rev-parse --path-format=absolute --git-common-dir 2>/dev/null))
ENV_FILE := $(firstword $(wildcard .env $(MAIN_CHECKOUT)/.env))
ENV_DEV_FILE := $(firstword $(wildcard .env.dev $(MAIN_CHECKOUT)/.env.dev))
# Load .env file if it exists (base configuration)
ifneq (,$(ENV_FILE))
include $(ENV_FILE)
export
endif
# Load .env.dev file if it exists (local development overrides)
ifneq (,$(ENV_DEV_FILE))
include $(ENV_DEV_FILE)
export
endif
# ─── Stack ─────────────────────────────────────────────────────────────────────
# Every worktree can run its own stack next to the others. The main checkout is
# stack 0 and keeps the ports and container names in the Compose files. A linked
# worktree gets its own number n on first use (scripts/stack-number.sh), and
# PROMPT_STACK=<n> overrides it. Stack n shifts every published host port by
# n * 100, names its containers prompt-<n>-* and runs under the Compose projects
# prompt-<n> and prompt-<n>-e2e. Docs: docs/contributor/setup.md.
#
# Only the targets that touch a stack ask for a number, so `make lint` or
# `make test` in a fresh worktree never takes one. `make stack` and `make stop`
# only look at a stack, so on their own they never take one either.
STACK_GOALS := stack stop stack-down server servers server-% clients client-% db db-down s3 \
seed test-e2e test-e2e-shard test-e2e-down test-e2e-ui verify-up verify-down
STACK_PEEK_GOALS := stack stop
ifneq (,$(filter $(STACK_GOALS),$(MAKECMDGOALS)))
STACK_PEEK := $(if $(filter-out $(STACK_PEEK_GOALS),$(filter $(STACK_GOALS),$(MAKECMDGOALS))),,--peek)
STACK := $(shell PROMPT_STACK='$(PROMPT_STACK)' PROMPT_STACK_FORCE='$(PROMPT_STACK_FORCE)' \
./scripts/stack-number.sh $(STACK_PEEK))
ifeq (,$(STACK))
$(error No stack number for this checkout, see the message above)
endif
ifneq (none,$(STACK))
export PROMPT_STACK := $(STACK)
STACK_OFFSET := $(shell echo $$(($(STACK) * 100)))
# Every PROMPT_PORT_<port> these files mention is <port> shifted to this stack.
# The Compose files fall back to <port> itself when the variable is unset.
STACK_PORT_FILES := Makefile docker-compose.yml docker-compose.stack.yml \
docker-compose.e2e.yml e2e/docker-compose.browser.yml
$(foreach port,$(shell grep -ohsE 'PROMPT_PORT_[0-9]+' $(STACK_PORT_FILES) | sort -u | \
awk -F_ '{ print $$0 "=" $$3 + $(STACK_OFFSET) }'),$(eval export $(port)))
# Read by core to register the phase services of a development stack, and by
# the client dev servers (clients/shared/rspack/devPorts.mjs).
export PROMPT_PORT_OFFSET := $(STACK_OFFSET)
export PROMPT_CLIENT_PORT := $(PROMPT_PORT_3000)
ifeq ($(STACK),0)
STACK_PREFIX := prompt
DEV_COMPOSE := docker compose
else
STACK_PREFIX := prompt-$(STACK)
DEV_COMPOSE := docker compose -p $(STACK_PREFIX) -f docker-compose.yml -f docker-compose.stack.yml
export PROMPT_CONTAINER_PREFIX := $(STACK_PREFIX)
# The host-run servers reach this stack's databases, Keycloak and S3 on its own
# ports. These are the port settings of .env.dev, which stack 0 keeps as is.
export DB_PORT := $(PROMPT_PORT_5432)
export DB_CORE_PORT := $(PROMPT_PORT_5432)
export DB_PORT_TEAM_ALLOCATION := $(PROMPT_PORT_5434)
export DB_PORT_SELF_TEAM_ALLOCATION := $(PROMPT_PORT_5436)
export DB_PORT_ASSESSMENT := $(PROMPT_PORT_5435)
export DB_PORT_CERTIFICATE := $(PROMPT_PORT_5439)
export DB_PORT_EXAMPLE_SERVER := $(PROMPT_PORT_5437)
export DB_PORT_INTERVIEW := $(PROMPT_PORT_5438)
export DB_PORT_PRESENTATION := $(PROMPT_PORT_5440)
export DB_PORT_INFRASTRUCTURE_SETUP := $(PROMPT_PORT_5441)
export DB_PORT_AI := $(PROMPT_PORT_5442)
export KEYCLOAK_HOST := http://localhost:$(PROMPT_PORT_8081)
# The stack's Keycloak imports keycloakConfig.json on its first start, which
# stores this placeholder as the prompt-server secret.
export KEYCLOAK_CLIENT_SECRET := **********
export S3_ENDPOINT := http://localhost:$(PROMPT_PORT_8334)
export S3_PUBLIC_ENDPOINT := http://localhost:$(PROMPT_PORT_8334)
export SERVER_CORE_HOST := http://localhost:$(PROMPT_PORT_8080)
export SERVER_AI_HOST := http://localhost:$(PROMPT_PORT_8092)
export CORE_HOST := http://localhost:$(PROMPT_PORT_3000)
endif
E2E_PROJECT := $(STACK_PREFIX)-e2e
endif
endif
# AI_ENABLED is the one switch for the AI server and its database (compose profile `ai`).
AI_PROFILE := $(if $(filter true,$(AI_ENABLED)),ai)
export COMPOSE_PROFILES := $(AI_PROFILE)
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# ─── Development ───────────────────────────────────────────────────────────────
# run-server <directory> <port>: each server listens on its own port, shifted to
# this stack. SERVER_ADDRESS from .env only contributes the interface to bind.
SERVER_BIND = $(or $(patsubst %:$(lastword $(subst :, ,$(SERVER_ADDRESS))),%,$(SERVER_ADDRESS)),localhost)
run-server = cd servers/$(1) && SERVER_ADDRESS=$(SERVER_BIND):$(2) go run main.go
server: server-core ## Start the core server (alias)
servers: ## Start all servers (core + all microservices)
@echo "Starting all servers..."
@$(MAKE) server-core &
@$(MAKE) server-assessment &
@$(MAKE) server-interview &
@$(MAKE) server-team-allocation &
@$(MAKE) server-self-team-allocation &
@$(MAKE) server-example &
@$(MAKE) server-certificate &
@$(MAKE) server-presentation &
@$(MAKE) server-infrastructure-setup &
$(if $(AI_PROFILE),@$(MAKE) server-ai &)
@wait
@echo "All servers started."
server-core: ## Start core server (port 8080)
$(call run-server,core,$(PROMPT_PORT_8080))
server-assessment: ## Start assessment server (port 8085)
$(call run-server,assessment,$(PROMPT_PORT_8085))
server-interview: ## Start interview server (port 8087)
$(call run-server,interview,$(PROMPT_PORT_8087))
server-team-allocation: ## Start team allocation server (port 8083)
$(call run-server,team_allocation,$(PROMPT_PORT_8083))
server-self-team-allocation: ## Start self team allocation server (port 8084)
$(call run-server,self_team_allocation,$(PROMPT_PORT_8084))
server-example: ## Start example server (port 8086)
$(call run-server,example_server,$(PROMPT_PORT_8086))
server-certificate: ## Start certificate server (port 8088)
$(call run-server,certificate,$(PROMPT_PORT_8088))
server-presentation: ## Start presentation server (port 8089)
$(call run-server,presentation,$(PROMPT_PORT_8089))
server-infrastructure-setup: ## Start infrastructure setup server (port 8091)
$(call run-server,infrastructure_setup,$(PROMPT_PORT_8091))
server-ai: ## Start AI server (port 8092), needs AI_ENABLED=true for its database
$(call run-server,ai,$(PROMPT_PORT_8092))
clients: ## Start all client micro-frontends
cd clients && yarn install && yarn run dev
client-core: ## Start only the core client
cd clients/core && yarn dev
client-certificate: ## Start only the certificate client
cd clients/certificate_component && yarn dev
client-ai: ## Start only the AI audit client
cd clients/ai_component && yarn dev
client-presentation: ## Start only the presentation client
cd clients/presentation_component && yarn dev
client-assessment: ## Start only the assessment client
cd clients/assessment_component && yarn dev
client-interview: ## Start only the interview client
cd clients/interview_component && yarn dev
client-matching: ## Start only the matching client
cd clients/matching_component && yarn dev
client-example: ## Start only the example client
cd clients/example_component && yarn dev
client-team-allocation: ## Start only the team allocation client
cd clients/team_allocation_component && yarn dev
client-self-team-allocation: ## Start only the self team allocation client
cd clients/self_team_allocation_component && yarn dev
client-infrastructure-setup: ## Start only the infrastructure setup client
cd clients/infrastructure_setup_component && yarn dev
DB_SERVICES = db db-team-allocation db-assessment db-self-team-allocation \
db-example-server db-interview db-certificate db-presentation \
db-infrastructure-setup $(if $(AI_PROFILE),db-ai)
db: ## Start every service database and Keycloak
$(DEV_COMPOSE) up -d $(DB_SERVICES) keycloak
db-down: ## Stop this stack's servers and client dev servers, its databases and Keycloak
@./scripts/stack-stop.sh $(STACK_OFFSET) $(DEV_PROCESS_PORTS)
$(DEV_COMPOSE) stop $(DB_SERVICES) keycloak
# The core and presentation servers refuse to start without their bucket store.
s3: ## Start the SeaweedFS S3 storage for file uploads
$(DEV_COMPOSE) up -d seaweedfs-volume seaweedfs-s3
# Runs in a container so no host psql is needed and the code path matches the
# one the e2e stack uses. The servers own the schemas, so start them once first.
seed: ## Load the demo course into every service database (re-runnable)
$(DEV_COMPOSE) run --rm seed
seed-check: ## Verify the cross-database references in seed/ resolve
./scripts/seed-check.sh
# The host ports, as in stack 0, that `make servers` and `make clients` listen on.
DEV_PROCESS_PORTS := 8080 8083 8084 8085 8086 8087 8088 8089 8091 8092 \
3000 3001 3002 3003 3005 3006 3007 3008 3009 3010 3011 3012 3013
ifeq (none,$(STACK))
stack:
@echo "stack none yet, the first make db, make servers or make clients here assigns one"
@echo "allocated (<git common dir>/prompt-stacks)"
@./scripts/stack-number.sh --list | sed 's/^/ /'
stop:
@echo "This worktree has no stack yet, so nothing of it runs."
else
stack: ## Show this checkout's stack number, ports and the allocated stacks
@echo "stack $(STACK) (containers $(STACK_PREFIX)-*, e2e containers $(STACK_PREFIX)-e2e-*)"
@echo "client http://localhost:$(PROMPT_PORT_3000) (remotes up to $(PROMPT_PORT_3012))"
@echo "core API http://localhost:$(PROMPT_PORT_8080)"
@echo "servers team allocation $(PROMPT_PORT_8083), self team allocation $(PROMPT_PORT_8084), assessment $(PROMPT_PORT_8085),"
@echo " example $(PROMPT_PORT_8086), interview $(PROMPT_PORT_8087), certificate $(PROMPT_PORT_8088),"
@echo " presentation $(PROMPT_PORT_8089), infrastructure setup $(PROMPT_PORT_8091)"
@echo "ai server $(PROMPT_PORT_8092), client $(PROMPT_PORT_3013), postgres $(PROMPT_PORT_5442) (with AI_ENABLED=true)"
@echo "keycloak http://localhost:$(PROMPT_PORT_8081)"
@echo "postgres core $(PROMPT_PORT_5432), keycloak $(PROMPT_PORT_5431), phase services $(PROMPT_PORT_5434)-$(PROMPT_PORT_5441)"
@echo "s3 http://localhost:$(PROMPT_PORT_8334)"
@echo "e2e/verify client $(PROMPT_PORT_4000), core API $(PROMPT_PORT_18090), keycloak $(PROMPT_PORT_18081), mailpit $(PROMPT_PORT_18025), s3 $(PROMPT_PORT_18333)"
@echo "compose $(DEV_COMPOSE)"
@echo " $(E2E_COMPOSE)"
@echo "allocated (<git common dir>/prompt-stacks)"
@./scripts/stack-number.sh --list | sed 's/^/ /'
# make servers and make clients run in the background, so Ctrl-C doesn't stop them.
stop: ## Stop this stack's servers and client dev servers (make servers, make clients)
@./scripts/stack-stop.sh $(STACK_OFFSET) $(DEV_PROCESS_PORTS)
endif
# Also works for the stack of a worktree that is already gone:
# make stack-down PROMPT_STACK=<n> from any checkout. down -v only removes the
# volumes the Compose files on disk declare, and a stack started from another
# branch can own more. scripts/stack-number.sh keeps a number taken while any
# volume carries the project label, so the volumes are removed by label too.
# Afterwards the stack's number is free again for any worktree.
stack-down: ## Stop this stack's processes, remove its dev and e2e containers and volumes, free its number (stack 1 and up)
@if [ "$(STACK)" = 0 ]; then \
echo "make stack-down: stack 0 is the main checkout's stack, which keeps its data in bind-mounted"; \
echo "directories. Use make db-down and make test-e2e-down there, or PROMPT_STACK=<n> for another stack."; \
exit 2; \
fi
@./scripts/stack-stop.sh $(STACK_OFFSET) $(DEV_PROCESS_PORTS)
$(DEV_COMPOSE) down -v --remove-orphans
unset $(E2E_ENV_KEYS); $(E2E_COMPOSE) down -v --remove-orphans
@for project in $(STACK_PREFIX) $(E2E_PROJECT); do \
vols=$$(docker volume ls -q --filter label=com.docker.compose.project=$$project); \
[ -z "$$vols" ] || docker volume rm $$vols; \
done
@./scripts/stack-number.sh --release $(STACK)
# ─── Code Quality ──────────────────────────────────────────────────────────────
lint: lint-clients lint-servers ## Lint all code
lint-clients: ## Lint all clients
cd clients && yarn biome check
./scripts/check-remote-styles.sh
lint-servers: ## Run go vet on all servers
cd servers/core && go vet ./...
cd servers/assessment && go vet ./...
cd servers/interview && go vet ./...
cd servers/team_allocation && go vet ./...
cd servers/self_team_allocation && go vet ./...
cd servers/example_server && go vet ./...
cd servers/certificate && go vet ./...
cd servers/presentation && go vet ./...
cd servers/infrastructure_setup && go vet ./...
cd servers/ai && go vet ./...
# ─── Testing ───────────────────────────────────────────────────────────────────
test: test-clients test-core test-assessment test-interview test-team-allocation test-self-team-allocation test-example test-certificate test-presentation test-infrastructure-setup test-ai ## Run all client and server tests
test-clients: ## Run all client unit tests
cd clients && yarn install && yarn test
test-core: ## Run core server tests
cd servers/core && go test ./...
test-assessment: ## Run assessment server tests
cd servers/assessment && go test ./...
test-interview: ## Run interview server tests
cd servers/interview && go test ./...
test-team-allocation: ## Run team allocation server tests
cd servers/team_allocation && go test ./...
test-self-team-allocation: ## Run self team allocation server tests
cd servers/self_team_allocation && go test ./...
test-example: ## Run example server tests
cd servers/example_server && go test ./...
test-certificate: ## Run certificate server tests
cd servers/certificate && go test ./...
test-presentation: ## Run presentation server tests
cd servers/presentation && go test ./...
test-infrastructure-setup: ## Run infrastructure setup server tests
cd servers/infrastructure_setup && go test ./...
test-ai: ## Run AI server tests
cd servers/ai && go test ./...
# ─── End-to-End Tests ──────────────────────────────────────────────────────────
# The e2e stack runs under its own Compose project (prompt-e2e, or prompt-<n>-e2e
# in stack n), so it never touches a dev stack's containers.
E2E_COMPOSE = docker compose -p $(E2E_PROJECT) -f docker-compose.e2e.yml --env-file e2e/.env.e2e
# The Makefile exports .env / .env.dev (host-mode overrides like DB_CORE_HOST=localhost),
# which Compose ranks above --env-file. Unset the keys e2e/.env.e2e defines so it stays authoritative.
E2E_ENV_KEYS := $(shell sed -nE 's/^([A-Za-z_][A-Za-z0-9_]*)=.*/\1/p' e2e/.env.e2e)
# Set SKIP_BUILD=1 to reuse the images already on the machine. Only safe when
# nothing under clients/, servers/, or e2e/ changed since the last build.
E2E_BUILD = $(if $(SKIP_BUILD),true,$(E2E_COMPOSE) build)
test-e2e: ## Whole suite in one container - CI-only, use test-e2e-shard SHARD=<name> locally
@mkdir -p e2e/playwright-report e2e/test-results e2e/blob-report
unset $(E2E_ENV_KEYS); \
$(E2E_BUILD); \
$(E2E_COMPOSE) run --rm e2e-runner; status=$$?; \
$(E2E_COMPOSE) down -v; \
exit $$status
test-e2e-shard: ## Run one CI module shard locally, e.g. make test-e2e-shard SHARD=interview (SKIP_BUILD=1 reuses existing images)
@mkdir -p e2e/playwright-report e2e/test-results e2e/blob-report
@if [ -z "$(SHARD)$(PATHS)" ]; then \
echo "make test-e2e-shard: set SHARD=<name> (or PATHS=\"<patterns>\"), else this would run the whole suite."; \
echo "Available shards:"; cd e2e && node scripts/shards.mjs names | sed 's/^/ /'; \
exit 2; \
fi
@set -e; \
paths="$(PATHS)"; \
if [ -z "$$paths" ]; then paths="$$(cd e2e && node scripts/shards.mjs paths "$(SHARD)")"; fi; \
ai="$(AI_ENABLED)"; \
if [ -n "$(SHARD)" ]; then ai="$$(cd e2e && node scripts/shards.mjs ai-enabled "$(SHARD)")"; fi; \
export AI_ENABLED="$$ai" COMPOSE_PROFILES="$$(if [ "$$ai" = true ]; then echo ai; fi)"; \
set -f; \
unset $(E2E_ENV_KEYS); \
$(E2E_BUILD); \
set +e; \
$(E2E_COMPOSE) run --rm e2e-runner npx playwright test $$paths; status=$$?; \
$(E2E_COMPOSE) down -v; \
exit $$status
test-e2e-down: ## Tear down the e2e stack and remove volumes
unset $(E2E_ENV_KEYS); COMPOSE_PROFILES=ai $(E2E_COMPOSE) down -v
test-e2e-ui: ## Interactive Playwright UI in Docker - then open http://127.0.0.1:8123 (shifted in stack n)
@mkdir -p e2e/playwright-report e2e/test-results
@echo "Starting the interactive Playwright UI - open http://127.0.0.1:$(PROMPT_PORT_8123) once it prints 'Listening'."
unset $(E2E_ENV_KEYS); \
$(E2E_COMPOSE) run --rm --build -p $(PROMPT_PORT_8123):8123 \
-v "$(CURDIR)/e2e/tests:/work/tests" \
-v "$(CURDIR)/e2e/src:/work/src" \
-v "$(CURDIR)/e2e/playwright-report:/work/playwright-report" \
-v "$(CURDIR)/e2e/test-results:/work/test-results" \
e2e-runner npx playwright test --ui-host=0.0.0.0 --ui-port=8123; \
$(E2E_COMPOSE) down -v
# ─── Browser Verification ─────────────────────────────────────────────────────
# Same seeded stack as the e2e suite, overlaid so the client, Keycloak and the
# core API are reachable as localhost:<published port>. That lets a browser on
# the host complete the login redirect and mint a token the servers accept.
# Driven by the `verify` skill.
VERIFY_COMPOSE = docker compose -p $(E2E_PROJECT) -f docker-compose.e2e.yml -f e2e/docker-compose.browser.yml --env-file e2e/.env.e2e
verify-up: ## Boot the seeded stack for host-browser verification (SKIP_BUILD=1 reuses existing images)
set -e; unset $(E2E_ENV_KEYS); export AI_ENABLED="$(AI_ENABLED)"; \
$(if $(SKIP_BUILD),true,$(VERIFY_COMPOSE) build); \
$(VERIFY_COMPOSE) up -d client-core server-core seed $(if $(AI_PROFILE),server-ai client-ai)
@echo ""
@echo "client http://localhost:$(PROMPT_PORT_4000)/management"
@echo "core API http://localhost:$(PROMPT_PORT_18090)"
@echo "keycloak http://localhost:$(PROMPT_PORT_18081)"
@echo "mailpit http://localhost:$(PROMPT_PORT_18025)"
@echo "s3 http://localhost:$(PROMPT_PORT_18333)"
@echo "seed log docker logs $(STACK_PREFIX)-e2e-seed"
@echo "logins username == password (lecturer, admin, student, ...)"
verify-down: ## Tear down the host-browser stack and remove volumes
unset $(E2E_ENV_KEYS); COMPOSE_PROFILES=ai $(VERIFY_COMPOSE) down -v
# ─── Code Generation ──────────────────────────────────────────────────────────
sqlc: sqlc-core sqlc-assessment sqlc-interview sqlc-team-allocation sqlc-self-team-allocation sqlc-example sqlc-certificate sqlc-presentation sqlc-infrastructure-setup sqlc-ai ## Generate sqlc code for all servers
sqlc-core: ## Generate sqlc code for core server
cd servers/core && sqlc generate
sqlc-assessment: ## Generate sqlc code for assessment server
cd servers/assessment && sqlc generate
sqlc-interview: ## Generate sqlc code for interview server
cd servers/interview && sqlc generate
sqlc-team-allocation: ## Generate sqlc code for team allocation server
cd servers/team_allocation && sqlc generate
sqlc-self-team-allocation: ## Generate sqlc code for self team allocation server
cd servers/self_team_allocation && sqlc generate
sqlc-example: ## Generate sqlc code for example server
cd servers/example_server && sqlc generate
sqlc-certificate: ## Generate sqlc code for certificate server
cd servers/certificate && sqlc generate
sqlc-presentation: ## Generate sqlc code for presentation server
cd servers/presentation && sqlc generate
sqlc-infrastructure-setup: ## Generate sqlc code for infrastructure setup server
cd servers/infrastructure_setup && sqlc generate
sqlc-ai: ## Generate sqlc code for AI server
cd servers/ai && sqlc generate
swagger: ## Generate swagger docs for core server
cd servers/core && swag init
# ─── Setup ─────────────────────────────────────────────────────────────────────
install-clients: ## Install client dependencies
cd clients && yarn install
install-hooks: ## Install git hooks (via the pre-commit framework)
git config --local --unset-all core.hooksPath 2>/dev/null || true
pre-commit install
setup-skills: ## Regenerate .claude/skills symlinks from .agents/skills (canonical source)
./scripts/setup-skills.sh
# DB_PORT is also defined in .env (included above), so only forward it when it
# was given on the command line; otherwise the script picks the next free port.
new-phase: ## Scaffold a new course phase (make new-phase NAME=<name> CLIENT_PORT=<port> SERVER_PORT=<port> [DB_PORT=<port>])
./scripts/new-course-phase.sh "$(NAME)" "$(CLIENT_PORT)" "$(SERVER_PORT)" "$(if $(filter command line,$(origin DB_PORT)),$(DB_PORT),)"