Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
669 lines (574 loc) · 26.4 KB
/
Copy pathjustfile
File metadata and controls
669 lines (574 loc) · 26.4 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
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
# ============================================================================
# Emailibrium — Root justfile
# ============================================================================
# Delegates to backend/justfile and frontend/justfile.
# Provides cross-cutting recipes for CI, Docker, releases, and docs.
#
# Quick Start:
# just - Show all available recipes (help)
# just --list - Terse auto-generated recipe list
# just install - Install all dependencies
# just dev - Start full stack (native)
# just docker-up-dev - Start full stack (Docker)
# just ci - Run full CI pipeline
# just VERSION=x.y.z release - Tag and release
# ============================================================================
# ============================================================================
# Settings, Variables and Configuration
# ============================================================================
# Match the Makefile's `SHELL := /bin/bash` — several recipes use bash-isms
# ([[ ]], &>, ${!var}). just's default shell is `sh -cu`, which would break them.
set shell := ["bash", "-c"]
BACKEND_DIR := "backend"
FRONTEND_DIR := "frontend"
COMPOSE := "docker compose"
COMPOSE_DEV := COMPOSE + " -f docker-compose.yml -f docker-compose.dev.yml"
# Delegation prefixes. just does not have make's `-C`; --justfile picks the file
# and --working-directory sets the cwd the sub-recipes run in.
BACKEND := "just --justfile " + BACKEND_DIR + "/justfile --working-directory " + BACKEND_DIR
FRONTEND := "just --justfile " + FRONTEND_DIR + "/justfile --working-directory " + FRONTEND_DIR
# Empty when lychee is not on PATH (link checking is optional — see links-check).
LYCHEE := `command -v lychee 2>/dev/null || echo ""`
# Colors. `|| echo ''` is a terminal-capability probe, not an error mask: tput
# fails when TERM is unset (CI, pipes) and we degrade to uncolored output.
BOLD := `tput bold 2>/dev/null || echo ''`
GREEN := `tput setaf 2 2>/dev/null || echo ''`
YELLOW := `tput setaf 3 2>/dev/null || echo ''`
BLUE := `tput setaf 4 2>/dev/null || echo ''`
RED := `tput setaf 1 2>/dev/null || echo ''`
RESET := `tput sgr0 2>/dev/null || echo ''`
# Argument-style variables, so `just VERSION=0.1.0 release` works like
# `make release VERSION=0.1.0`. The recipes below also accept the version /
# model positionally, and tolerate a literal `VERSION=`/`MODEL=` prefix.
VERSION := ""
MODEL := ""
# find with -prune avoids traversing multi-GB Rust target/ and node_modules/ dirs
# (prettier's own glob walker enters all dirs before filtering via .prettierignore)
# Keep this list in sync with .markdownlint-cli2.jsonc's `ignores` — otherwise
# format-check-md walks agent-tool scaffolding (.agents/, .codex/, .optimizer/)
# that lint-md correctly skips, and the two checks disagree about the same file.
PRUNE_DIRS := '\( -name node_modules -o -name target -o -name ruvector -o -name .claude -o -name .claude-flow -o -name .git -o -name .agentic-qe -o -name .swarm -o -name .beads -o -name .agents -o -name .codex -o -name .optimizer -o -name .git-rewrite -o -name dist -o -name storybook-static -o -name coverage \) -prune'
# ============================================================================
# Default Recipe
# ============================================================================
# Show all available recipes, grouped
[group('help')]
help:
#!/usr/bin/env bash
set -euo pipefail
cat <<'HELP'
{{BOLD}}{{BLUE}}╔════════════════════════════════════════════════════════════════════╗{{RESET}}
{{BOLD}}{{BLUE}}║ Emailibrium justfile ║{{RESET}}
{{BOLD}}{{BLUE}}╚════════════════════════════════════════════════════════════════════╝{{RESET}}
{{BOLD}}Quick Start:{{RESET}}
just setup - Guided first-time setup wizard
just install - Install all dependencies
just dev - Start backend + frontend (native)
just dev-llm - Start with built-in LLM (llama.cpp)
just models - Show available LLM models
just embedding-models - Show available embedding models
just download-model - Download a model (MODEL=<id>)
just docker-up-dev - Start full stack (Docker)
just ci - Run full CI pipeline
just test - Run all tests
{{BOLD}}{{BLUE}}═══ Setup & Onboarding ═════════════════════════════════════════════{{RESET}}
setup - Guided first-time setup wizard
setup-prereqs - Check all prerequisites
setup-secrets - Generate/configure secrets
setup-ai - Configure AI providers
setup-docker - Set up Docker environment
setup-validate - Validate entire setup
{{BOLD}}{{BLUE}}═══ Install & Build ═════════════════════════════════════════════════{{RESET}}
install - Install all dependencies (backend + frontend)
build - Build everything
dev - Start full stack dev servers (native)
dev-llm - Start with built-in LLM (llama.cpp)
clean - Clean all build artifacts
clean-data - Remove all local data (DB, vectors)
clean-all - Clean build artifacts + all local data
{{BOLD}}{{BLUE}}═══ AI & Models ═════════════════════════════════════════════════════{{RESET}}
models - Show available LLM models
embedding-models - Show available embedding models
download-model MODEL=x - Download a specific model
download-models - Download AI models (ONNX + GGUF)
diagnose - Show AI configuration diagnostics
{{BOLD}}{{BLUE}}═══ Test ════════════════════════════════════════════════════════════{{RESET}}
test - Run all tests (backend + frontend)
{{BOLD}}{{BLUE}}═══ Lint & Format ═══════════════════════════════════════════════════{{RESET}}
lint - Lint everything (code + docs)
format - Format everything (code + docs)
format-check - Check formatting (no changes)
typecheck - TypeScript type check
{{BOLD}}{{BLUE}}═══ Security & Quality ═════════════════════════════════════════════{{RESET}}
audit - Security audit all dependencies
deadcode - Check for dead code
ci - Full CI pipeline
ci-full - CI + link checking
{{BOLD}}{{BLUE}}═══ Dependency Management ══════════════════════════════════════════{{RESET}}
upgrade - Upgrade all deps (within semver)
outdated - Show outdated deps (no changes)
{{BOLD}}{{BLUE}}═══ Documentation ══════════════════════════════════════════════════{{RESET}}
lint-md - Lint Markdown files
lint-yaml - Lint YAML files
links-check - Check internal links in Markdown
links-check-external - Check external links (slow)
links-check-all - Check all links
{{BOLD}}{{BLUE}}═══ Docker ═════════════════════════════════════════════════════════{{RESET}}
docker-up - Start production stack
docker-up-dev - Start dev stack (hot-reload)
docker-down - Stop all containers
docker-down-volumes - Stop + remove volumes (DESTROYS DATA)
docker-restart - Restart all containers
docker-build - Build Docker images
docker-build-no-cache - Build images without cache
docker-logs - Tail all container logs
docker-logs-backend - Tail backend logs
docker-logs-frontend - Tail frontend logs
docker-ps - Show container status
docker-exec-backend - Shell into backend container
docker-exec-frontend - Shell into frontend container
docker-health - Health check all containers
docker-clean - Prune dangling Docker artifacts
docker-secrets - Generate dev secrets
{{BOLD}}{{BLUE}}═══ Release ════════════════════════════════════════════════════════{{RESET}}
release-check - Pre-release CI validation
release-tag VERSION=x.y.z - Create annotated tag
release-push - Push latest tag to trigger release
release VERSION=x.y.z - Full release (check + tag + push)
changelog - Regenerate CHANGELOG.md
Run '{{BOLD}}cd backend && just --list{{RESET}}' or '{{BOLD}}cd frontend && just --list{{RESET}}' for layer-specific recipes.
HELP
# ============================================================================
# Setup & Onboarding
# ============================================================================
# Guided first-time setup wizard
[group('setup')]
setup:
@bash scripts/setup.sh
# Check all prerequisites
[group('setup')]
setup-prereqs:
@bash scripts/setup-prereqs.sh
# Generate/configure secrets
[group('setup')]
setup-secrets:
@bash scripts/setup-secrets.sh
# Configure AI providers
[group('setup')]
setup-ai:
@bash scripts/setup-ai.sh
# Set up Docker environment
[group('setup')]
setup-docker:
@bash scripts/setup-docker.sh
# Validate entire setup
[group('setup')]
setup-validate:
@bash scripts/setup-validate.sh
# ============================================================================
# AI & Models
# ============================================================================
# Download AI models (ONNX embedding + GGUF LLM)
[group('ai')]
download-models:
#!/usr/bin/env bash
set -euo pipefail
echo "{{BOLD}}{{BLUE}}Downloading AI models...{{RESET}}"
echo "{{GREEN}}Step 1:{{RESET}} ONNX embedding model"
# The Makefile hid the real error here (`2>/dev/null || echo hint`) and still
# exited 0. Keep the hint, but surface stderr and fail honestly.
if ! (cd {{BACKEND_DIR}} && cargo run -- --download-models); then
echo " {{YELLOW}}Backend not built. Run 'just build' first.{{RESET}}" >&2
exit 1
fi
echo "{{GREEN}}Step 2:{{RESET}} GGUF LLM model (qwen2.5-0.5b-q4km)"
if ! (cd {{FRONTEND_DIR}}/apps/web && npx tsx ../../../scripts/models.ts download --default); then
echo " {{YELLOW}}Frontend not installed. Run 'just install' first.{{RESET}}" >&2
exit 1
fi
echo "{{GREEN}}Done.{{RESET}} Models cached for offline use."
# Show AI configuration diagnostics
[group('ai')]
diagnose:
#!/usr/bin/env bash
set -euo pipefail
echo "{{BOLD}}{{BLUE}}Emailibrium AI Diagnostics{{RESET}}"
echo "────────────────────────────────────────"
echo ""
echo "{{BOLD}}Embedding:{{RESET}}"
if [[ -d "{{BACKEND_DIR}}/.fastembed_cache" ]]; then
echo " Provider: ONNX (all-MiniLM-L6-v2)"
echo " Status: {{GREEN}}cached{{RESET}} ($(du -sh {{BACKEND_DIR}}/.fastembed_cache 2>/dev/null | cut -f1))"
else
echo " Provider: ONNX (all-MiniLM-L6-v2)"
echo " Status: {{YELLOW}}not cached (downloads on first use){{RESET}}"
fi
echo ""
echo "{{BOLD}}Generative (LLM):{{RESET}}"
CACHE="$HOME/.emailibrium/models/llm"
if [[ -d "$CACHE" ]] && find "$CACHE" -name "*.gguf" -print -quit 2>/dev/null | grep -q .; then
LLM_MODEL=$(find "$CACHE" -name "*.gguf" -print -quit 2>/dev/null | xargs basename)
SIZE=$(du -sh "$CACHE" 2>/dev/null | cut -f1)
echo " Provider: builtin ($LLM_MODEL)"
echo " Status: {{GREEN}}cached{{RESET}} ($SIZE)"
else
echo " Provider: builtin (qwen2.5-0.5b-q4km)"
echo " Status: {{YELLOW}}not cached{{RESET}}"
echo " Fix: just download-models"
fi
echo ""
echo "{{BOLD}}Ollama:{{RESET}}"
if command -v ollama &>/dev/null && ollama list &>/dev/null 2>&1; then
echo " Status: {{GREEN}}running{{RESET}}"
elif command -v ollama &>/dev/null; then
echo " Status: {{YELLOW}}installed but not running{{RESET}}"
else
echo " Status: not installed (optional)"
fi
echo ""
echo "{{BOLD}}Cloud APIs:{{RESET}}"
for var in EMAILIBRIUM_OPENAI_API_KEY EMAILIBRIUM_ANTHROPIC_API_KEY EMAILIBRIUM_GEMINI_API_KEY; do
name=$(echo "$var" | sed 's/EMAILIBRIUM_//;s/_API_KEY//')
if [[ -n "${!var:-}" ]]; then
echo " $name: {{GREEN}}configured{{RESET}}"
else
echo " $name: not configured"
fi
done
echo ""
echo "{{BOLD}}Database:{{RESET}}"
if [[ -f "{{BACKEND_DIR}}/emailibrium-dev.db" ]]; then
echo " Status: {{GREEN}}exists{{RESET}} ($(du -sh {{BACKEND_DIR}}/emailibrium-dev.db 2>/dev/null | cut -f1))"
else
echo " Status: not created yet (created on first run)"
fi
# Show available LLM models with hardware recommendations
[group('ai')]
models:
@{{BACKEND}} models
# Show available embedding models
[group('ai')]
embedding-models:
@{{BACKEND}} embedding-models
# Download a model (e.g. just download-model qwen3-8b-q4km)
[group('ai')]
download-model model=MODEL:
#!/usr/bin/env bash
set -euo pipefail
# Accept `just download-model qwen3-8b-q4km`, `just download-model MODEL=qwen3-8b-q4km`
# and `just MODEL=qwen3-8b-q4km download-model`.
m="{{model}}"; m="${m#MODEL=}"
if [[ -z "$m" ]]; then
echo "{{YELLOW}}Usage: just download-model MODEL=<id> (see: just models){{RESET}}" >&2
exit 1
fi
{{BACKEND}} download-model "$m"
# ============================================================================
# Install & Build
# ============================================================================
# Install all dependencies (backend `build` is its dependency-fetch step)
[group('build')]
install:
@{{BACKEND}} build
@{{FRONTEND}} install
# Build everything
[group('build')]
build:
@{{BACKEND}} build
@{{FRONTEND}} build
# Start full stack dev servers (native, loads secrets/dev/ as env vars)
[group('build')]
dev:
#!/usr/bin/env bash
set -euo pipefail
echo "{{GREEN}}Backend: http://localhost:8080 Frontend: http://localhost:3000{{RESET}}"
# Missing secret files yield empty values by design (dev works before
# `just setup-secrets`); an unreadable file still fails loudly under set -e.
secret() { local f="secrets/dev/$1"; if [[ -f "$f" ]]; then cat "$f"; else printf ''; fi; }
export EMAILIBRIUM_GOOGLE_CLIENT_ID="$(secret google_client_id)"
export EMAILIBRIUM_GOOGLE_CLIENT_SECRET="$(secret google_client_secret)"
export EMAILIBRIUM_MICROSOFT_CLIENT_ID="$(secret microsoft_client_id)"
export EMAILIBRIUM_MICROSOFT_CLIENT_SECRET="$(secret microsoft_client_secret)"
export JWT_SECRET="$(secret jwt_secret)"
export EMAILIBRIUM_ENCRYPTION_MASTER_PASSWORD="$(secret oauth_encryption_key)"
export RATE_LIMIT_PRESET=development
trap 'kill 0' INT TERM EXIT
{{BACKEND}} dev &
{{FRONTEND}} dev &
wait
# Start full stack with built-in LLM (downloads ~350MB model on first run)
[group('build')]
dev-llm:
#!/usr/bin/env bash
set -euo pipefail
echo "{{GREEN}}Backend (LLM): http://localhost:8080 Frontend: http://localhost:3000{{RESET}}"
secret() { local f="secrets/dev/$1"; if [[ -f "$f" ]]; then cat "$f"; else printf ''; fi; }
export EMAILIBRIUM_GOOGLE_CLIENT_ID="$(secret google_client_id)"
export EMAILIBRIUM_GOOGLE_CLIENT_SECRET="$(secret google_client_secret)"
export EMAILIBRIUM_MICROSOFT_CLIENT_ID="$(secret microsoft_client_id)"
export EMAILIBRIUM_MICROSOFT_CLIENT_SECRET="$(secret microsoft_client_secret)"
export JWT_SECRET="$(secret jwt_secret)"
export EMAILIBRIUM_ENCRYPTION_MASTER_PASSWORD="$(secret oauth_encryption_key)"
export RATE_LIMIT_PRESET=development
trap 'kill 0' INT TERM EXIT
{{BACKEND}} dev-llm &
{{FRONTEND}} dev &
wait
# Clean all build artifacts
[group('build')]
clean:
@{{BACKEND}} clean
@{{FRONTEND}} clean
# Remove all local data (DB, vectors) — fresh start
[group('build')]
clean-data:
@{{BACKEND}} clean-data
# Clean build artifacts + all local data
[group('build')]
clean-all:
@{{BACKEND}} clean-all
@{{FRONTEND}} clean
# ============================================================================
# Test
# ============================================================================
# Run all tests
[group('test')]
test:
@{{BACKEND}} test
@{{FRONTEND}} test
# ============================================================================
# Lint & Format
# ============================================================================
# Lint everything (code + docs)
[group('lint')]
lint: lint-docs
@{{BACKEND}} lint
@{{FRONTEND}} lint
# Format everything (code + docs)
[group('lint')]
format: format-docs
@{{BACKEND}} format
@{{FRONTEND}} format
# Check formatting (no changes)
[group('lint')]
format-check: format-check-docs
@{{BACKEND}} format-check
@{{FRONTEND}} format-check
# Type check (frontend)
[group('lint')]
typecheck:
@{{FRONTEND}} typecheck
# ============================================================================
# Security & Quality
# ============================================================================
# Security audit all dependencies
[group('security')]
audit:
@{{BACKEND}} audit
@{{FRONTEND}} audit
# Check for dead code
[group('security')]
deadcode:
@{{BACKEND}} deadcode
@{{FRONTEND}} deadcode
# Full CI pipeline
[group('security')]
ci: format-check lint typecheck test
# Full CI + link checking
[group('security')]
ci-full: ci links-check
# ============================================================================
# Dependency Management
# ============================================================================
# Upgrade all dependencies (within semver)
[group('deps')]
upgrade:
@{{BACKEND}} upgrade
@{{FRONTEND}} upgrade
# Show outdated dependencies (no changes)
[group('deps')]
outdated:
@{{BACKEND}} outdated
@{{FRONTEND}} outdated
# ============================================================================
# Documentation (Markdown, YAML, Links)
# ============================================================================
# Lint Markdown files (strict — fails on errors or missing tool)
[group('docs')]
lint-md:
@echo "{{GREEN}}Linting Markdown...{{RESET}}"
@command -v markdownlint-cli2 >/dev/null 2>&1 || { echo "{{RED}}markdownlint-cli2 not installed. Run: npm i -g markdownlint-cli2{{RESET}}"; exit 1; }
@markdownlint-cli2 '**/*.md' '#**/node_modules' '#**/target' '#.claude/worktrees/**' '#ruvector/**'
# Lint YAML files (strict — fails on errors or missing tool)
[group('docs')]
lint-yaml:
@echo "{{GREEN}}Linting YAML...{{RESET}}"
@command -v yamllint >/dev/null 2>&1 || { echo "{{RED}}yamllint not installed. Run: pip install yamllint{{RESET}}"; exit 1; }
@find . \( -name node_modules -o -name target -o -name ruvector -o -name .claude -o -name .claude-flow \) -prune -o \( -name '*.yaml' -o -name '*.yml' \) ! -name 'pnpm-lock.yaml' -print | xargs -r yamllint -c .yamllint.yaml
# Lint all docs (Markdown + YAML)
[group('docs')]
lint-docs: lint-md lint-yaml
# Format Markdown files
[group('docs')]
format-md:
@find . {{PRUNE_DIRS}} -o -name '*.md' -print | xargs npx prettier --write --no-error-on-unmatched-pattern
# Format YAML files
[group('docs')]
format-yaml:
@find . {{PRUNE_DIRS}} -o \( -name '*.yaml' -o -name '*.yml' \) ! -name 'pnpm-lock.yaml' -print | xargs npx prettier --write --no-error-on-unmatched-pattern
# Format docs (Markdown + YAML)
[group('docs')]
format-docs: format-md format-yaml
# Check Markdown formatting (no changes)
[group('docs')]
format-check-md:
@find . {{PRUNE_DIRS}} -o -name '*.md' -print | xargs npx prettier --check --no-error-on-unmatched-pattern
# Check YAML formatting (no changes)
[group('docs')]
format-check-yaml:
@find . {{PRUNE_DIRS}} -o \( -name '*.yaml' -o -name '*.yml' \) ! -name 'pnpm-lock.yaml' -print | xargs npx prettier --check --no-error-on-unmatched-pattern
# Check docs formatting (Markdown + YAML)
[group('docs')]
format-check-docs: format-check-md format-check-yaml
# Check internal links in Markdown
[group('docs')]
links-check:
#!/usr/bin/env bash
set -euo pipefail
echo "{{GREEN}}Checking local file links...{{RESET}}"
if [ -n "{{LYCHEE}}" ]; then
{{LYCHEE}} --scheme file --include-fragments --config .lychee.toml '**/*.md'
else
echo "{{YELLOW}}lychee not installed. Run: cargo install lychee{{RESET}}"
fi
# Check external links (may take minutes)
[group('docs')]
links-check-external:
#!/usr/bin/env bash
set -euo pipefail
echo "{{GREEN}}Checking external links...{{RESET}}"
if [ -n "{{LYCHEE}}" ]; then
{{LYCHEE}} --scheme https --scheme http --config .lychee.toml '**/*.md'
else
echo "{{YELLOW}}lychee not installed. Run: cargo install lychee{{RESET}}"
fi
# Check all links (internal + external)
[group('docs')]
links-check-all: links-check links-check-external
# ============================================================================
# Docker
# ============================================================================
# Start production stack
[group('docker')]
docker-up:
@echo "{{GREEN}}Starting Emailibrium stack...{{RESET}}"
@{{COMPOSE}} up -d
@echo "{{GREEN}}Backend: http://localhost:8080 Frontend: http://localhost:3000{{RESET}}"
# Start dev stack (hot-reload)
[group('docker')]
docker-up-dev:
@echo "{{GREEN}}Starting Emailibrium dev stack...{{RESET}}"
@{{COMPOSE_DEV}} up -d
@echo "{{GREEN}}Backend: http://localhost:8080 Frontend: http://localhost:3000{{RESET}}"
# Stop and remove containers
[group('docker')]
docker-down:
@{{COMPOSE}} down
# Stop + remove volumes (DESTROYS DATA)
[group('docker')]
docker-down-volumes:
@{{COMPOSE}} down -v
# Restart all containers
[group('docker')]
docker-restart: docker-down docker-up
# Build Docker images
[group('docker')]
docker-build:
@{{COMPOSE}} build
# Build images without cache
[group('docker')]
docker-build-no-cache:
@{{COMPOSE}} build --no-cache
# Tail logs from all containers
[group('docker')]
docker-logs:
@{{COMPOSE}} logs -f
# Tail backend logs
[group('docker')]
docker-logs-backend:
@{{COMPOSE}} logs -f backend
# Tail frontend logs
[group('docker')]
docker-logs-frontend:
@{{COMPOSE}} logs -f frontend
# Show running containers
[group('docker')]
docker-ps:
@{{COMPOSE}} ps
# Shell into backend container
[group('docker')]
docker-exec-backend:
@{{COMPOSE}} exec backend sh
# Shell into frontend container
[group('docker')]
docker-exec-frontend:
@{{COMPOSE}} exec frontend sh
# Health check all containers
[group('docker')]
docker-health:
@{{COMPOSE}} ps --format "table {{{{.Name}}\t{{{{.Status}}\t{{{{.Ports}}"
# Prune dangling Docker artifacts
[group('docker')]
docker-clean:
# `|| true` retained: pruning is best-effort cleanup scoped to this project's
# label, and a no-op/absent-daemon prune must not fail the recipe.
@docker system prune -f --filter "label=com.docker.compose.project=emailibrium" 2>/dev/null || true
# Generate development secrets
[group('docker')]
docker-secrets:
@mkdir -p secrets/dev
@openssl rand -base64 32 > secrets/dev/jwt_secret
@openssl rand -base64 32 > secrets/dev/oauth_encryption_key
@echo "postgres://emailibrium:devpass@postgres:5432/emailibrium" > secrets/dev/database_url
@echo "devpass" > secrets/dev/db_password
@chmod 600 secrets/dev/*
@echo "{{GREEN}}Secrets generated in secrets/dev/{{RESET}}"
# ============================================================================
# Release
# ============================================================================
# Pre-release CI validation
[group('release')]
release-check: ci
@echo "{{GREEN}}Release checks passed. Ready to tag.{{RESET}}"
# Tag a release (usage: just release-tag VERSION=0.1.0)
[group('release')]
release-tag version=VERSION:
#!/usr/bin/env bash
set -euo pipefail
v="{{version}}"; v="${v#VERSION=}"
if [ -z "$v" ]; then echo "{{YELLOW}}Usage: just release-tag VERSION=0.1.0{{RESET}}"; exit 1; fi
git tag -a "v$v" -m "Release v$v"
echo "{{GREEN}}Tagged v$v. Push with: git push origin v$v{{RESET}}"
# Push latest tag to trigger release workflow
[group('release')]
release-push:
#!/usr/bin/env bash
set -euo pipefail
# `|| TAG=""` is not error masking: "no tags yet" is the expected first-run
# state, and the -z check below turns it into an explicit exit 1.
TAG=$(git describe --tags --abbrev=0 2>/dev/null) || TAG=""
if [ -z "$TAG" ]; then echo "{{YELLOW}}No tags found.{{RESET}}"; exit 1; fi
echo "{{GREEN}}Pushing $TAG to origin...{{RESET}}"
git push origin "$TAG"
# Cut a release (bumps versions, updates CHANGELOG, commits, tags, pushes). Usage: just release VERSION=0.1.0
[group('release')]
release version=VERSION:
#!/usr/bin/env bash
set -euo pipefail
v="{{version}}"; v="${v#VERSION=}"
[ -n "$v" ] || { echo "usage: just release VERSION=X.Y.Z" >&2; exit 1; }
./scripts/release.sh "$v"
# Regenerate CHANGELOG.md from git history using git-cliff
[group('release')]
changelog:
git-cliff --output CHANGELOG.md