-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
463 lines (409 loc) · 21.8 KB
/
Copy pathMakefile
File metadata and controls
463 lines (409 loc) · 21.8 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
#!/usr/bin/make -f
#
# tpcli-pi-tools Makefile - Comprehensive DevOps & Testing Framework
#
# DESIGN PRINCIPLES:
# - Single source of truth for all DevOps and testing tooling
# - GitHub workflows use make targets (no tool duplication)
# - Graduated test ladder with consistent naming (test-*)
# - Local/CI parity (what passes locally passes in CI)
# - All tools and checks integrated into one framework
#
# SHELL & BASH CONVENTIONS:
# - Uses bash (.SHELLFLAGS) with strict mode
# - All shell code checked with shellcheck -x
# - Prefer bash builtins, use external tools only when necessary
# - Modern bash constructs (arrays, parameter expansion)
# - All variables properly quoted
#
# Better make configuration
MAKEFLAGS += --no-print-directory
MAKEFLAGS += --warn-undefined-variables
.ONESHELL:
SHELL := /bin/bash
.SHELLFLAGS := -o errexit -o nounset -o pipefail -ec
# Set default goal
.DEFAULT_GOAL := help
# Quiet specific targets
.SILENT: help venv clean
# Variables
PYTHON := python3
UV := uv
VENV_DIR := .venv
PYTHON_VERSION := 3.11
BIN_DIR := $(VENV_DIR)/bin
GO := go
TPCLI_BIN := $(BIN_DIR)/tpcli
# Better PATH management
export PATH := $(PWD)/$(BIN_DIR):$(HOME)/.local/bin:$(PATH)
# Source color helpers (uses tput for proper ANSI sequences)
COLORS_SH := ./scripts/colors.sh
# Helper to safely execute with colors (works with strict bash mode)
define with_colors
source $(COLORS_SH) && $1
endef
## help: Show available make targets with organized categories
help:
source $(COLORS_SH) && { \
printf "%s%s%s\n" "$${BLUE}" "tpcli-pi-tools - PI Planning Tools for TargetProcess" "$${RESET}"; \
printf "\n"; \
printf "%s%s%s\n" "$${GREEN}" "Installation targets:" "$${RESET}"; \
printf " %-20s - %s\n" "install" "Install for local development"; \
printf " %-20s - %s\n" "install-dev" "Install with dev tools (testing, linting)"; \
printf " %-20s - %s\n" "install-global" "Install globally via uv tool install"; \
printf " %-20s - %s\n" "venv" "Create Python virtual environment"; \
printf " %-20s - %s\n" "tpcli" "Build tpcli Go binary"; \
printf "\n"; \
printf "%s%s%s\n" "$${GREEN}" "Testing - Graduated Test Ladder:" "$${RESET}"; \
printf " %-20s - %s\n" "test" "COMPLETE LADDER: All checks + tests (use before pushing)"; \
printf "\n Phase 0 (Syntax):\n"; \
printf " %-17s - %s\n" "test-structure" "Python syntax validation"; \
printf "\n Phase 0.25 (Imports):\n"; \
printf " %-17s - %s\n" "test-imports" "Check for broken imports"; \
printf "\n Phase 0.5 (Format):\n"; \
printf " %-17s - %s\n" "test-format" "Code formatting check"; \
printf "\n Phase 0.6 (Linting):\n"; \
printf " %-17s - %s\n" "test-lint" "Code quality (Python + Go linting)"; \
printf "\n Phase 0.7 (Vet):\n"; \
printf " %-17s - %s\n" "test-vet" "Go vet checks"; \
printf "\n Phase 1 (Types):\n"; \
printf " %-17s - %s\n" "test-types" "Type checking (mypy)"; \
printf "\n Phase 1.25 (Complexity - INFO ONLY):\n"; \
printf " %-17s - %s\n" "test-complexity" "Code complexity analysis"; \
printf "\n Phase 1.5 (Security):\n"; \
printf " %-17s - %s\n" "test-security" "Security scanning (bandit + semgrep)"; \
printf "\n Phase 2 (Unit Tests):\n"; \
printf " %-17s - %s\n" "test-unit" "Python pytest tests"; \
printf "\n Phase 3 (BDD Tests):\n"; \
printf " %-17s - %s\n" "test-bdd" "BDD feature tests (behave)"; \
printf "\n Phase 4 (Go Tests):\n"; \
printf " %-17s - %s\n" "test-go" "Go unit tests"; \
printf "\n"; \
printf "%s%s%s\n" "$${GREEN}" "Code Quality & Formatting:" "$${RESET}"; \
printf " %-20s - %s\n" "test-cov" "Run test ladder with coverage collection"; \
printf " %-20s - %s\n" "check" "Quick check (lint + type-check only)"; \
printf " %-20s - %s\n" "format-fix" "Auto-format code with ruff"; \
printf "\n"; \
printf "%s%s%s\n" "$${GREEN}" "Utility targets:" "$${RESET}"; \
printf " %-20s - %s\n" "clean" "Remove venv, binaries, and artifacts"; \
printf " %-20s - %s\n" "run" "Run command in venv (CMD=...)"; \
printf " %-20s - %s\n" "docs" "Show documentation location"; \
printf " %-20s - %s\n" "show-config" "Open tpcli config in editor"; \
printf " %-20s - %s\n" "all" "Full setup: install-dev, check, test"; \
printf " %-20s - %s\n" "uat" "User Acceptance Testing (end-to-end)"; \
printf "\n"; \
}
## venv: Create Python virtual environment
venv:
source $(COLORS_SH) && { \
printf "%s%s%s\n" "$${BLUE}" "Creating virtual environment..." "$${RESET}"; \
if [[ -d "$(VENV_DIR)" ]]; then \
printf "%s⚠ %s%s\n" "$${YELLOW}" "Virtual environment already exists, skipping..." "$${RESET}"; \
else \
$(UV) venv $(VENV_DIR) --python $(PYTHON_VERSION); \
printf "%s✓ %s%s\n" "$${GREEN}" "Virtual environment created" "$${RESET}"; \
printf "\n"; \
printf "Activate with: source $(VENV_DIR)/bin/activate\n"; \
fi; \
}
## tpcli: Build and install tpcli Go binary
tpcli: venv
source $(COLORS_SH) && { \
printf "%s%s%s\n" "$${BLUE}" "Building tpcli Go binary..." "$${RESET}"; \
if command -v $(GO) &> /dev/null; then \
$(GO) build -o $(TPCLI_BIN) .; \
printf "%s✓ %s%s\n" "$${GREEN}" "tpcli binary installed: $(TPCLI_BIN)" "$${RESET}"; \
else \
printf "%s⚠ %s%s\n" "$${YELLOW}" "Go not found - skipping tpcli build" "$${RESET}"; \
printf "%s %s%s\n" "$${YELLOW}" "Install Go from https://golang.org/doc/install" "$${RESET}"; \
fi; \
}
## install: Install tpcli-pi-tools (basic)
install: venv tpcli
source $(COLORS_SH) && { \
printf "%s%s%s\n" "$${BLUE}" "Installing tpcli-pi-tools..." "$${RESET}"; \
$(UV) sync; \
if [ -f "$(TPCLI_BIN)" ]; then \
mkdir -p "$${HOME}/.local/bin"; \
cp "$(TPCLI_BIN)" "$${HOME}/.local/bin/tpcli"; \
printf "%s✓ %s%s\n" "$${GREEN}" "tpcli binary installed: ~/.local/bin/tpcli" "$${RESET}"; \
printf "\n"; \
printf "%s⚠ %s%s\n" "$${YELLOW}" "IMPORTANT: Clear your shell's command cache:" "$${RESET}"; \
printf " hash -r\n"; \
printf " (or restart your shell/tmux session)\n"; \
printf "\n"; \
fi; \
printf "%s✓ %s%s\n" "$${GREEN}" "Installation complete" "$${RESET}"; \
printf "\n"; \
printf "Available commands (run with 'uv run'):\n"; \
printf " uv run art-dashboard - ART-wide PI planning overview\n"; \
printf " uv run team-deep-dive - Team capacity and risk analysis\n"; \
printf " uv run objective-deep-dive - Objective details and assessment\n"; \
printf " uv run release-status - PI progress tracking\n"; \
printf "\n"; \
printf "Or activate venv: source $(VENV_DIR)/bin/activate\n"; \
printf "Then: art-dashboard --help\n"; \
}
## install-dev: Install with development tools (test, lint, type-check)
install-dev: venv tpcli
source $(COLORS_SH) && { \
printf "%s%s%s\n" "$${BLUE}" "Installing tpcli-pi-tools with dev tools..." "$${RESET}"; \
$(UV) sync --all-extras; \
printf "%s✓ %s%s\n" "$${GREEN}" "Development installation complete" "$${RESET}"; \
printf "\n"; \
printf "Available dev commands:\n"; \
printf " make test - Run complete test ladder\n"; \
printf " make check - Quick lint + type-check\n"; \
printf " make format-fix - Auto-format code\n"; \
printf "\n"; \
}
## install-global: Install tools globally without polluting user's venv
install-global:
source $(COLORS_SH) && { \
printf "%s%s%s\n" "$${BLUE}" "Installing tpcli-pi-tools globally..." "$${RESET}"; \
if ! command -v $(UV) &> /dev/null; then \
printf "%s✗ %s%s\n" "$${RED}" "Error: uv not found - cannot install globally" "$${RESET}" >&2; \
printf "Install uv from https://astral.sh/uv\n"; \
exit 1; \
fi; \
$(UV) tool install -e .; \
printf "\n"; \
if command -v $(GO) &> /dev/null; then \
mkdir -p "$${HOME}/.local/bin"; \
$(GO) build -o "$${HOME}/.local/bin/tpcli" .; \
printf "%s✓ %s%s\n" "$${GREEN}" "tpcli binary installed: ~/.local/bin/tpcli" "$${RESET}"; \
else \
printf "%s⚠ %s%s\n" "$${YELLOW}" "Go not found - tpcli binary not installed" "$${RESET}"; \
printf "%s %s%s\n" "$${YELLOW}" "Install Go from https://golang.org/doc/install" "$${RESET}"; \
fi; \
printf "\n"; \
printf "%s✓ %s%s\n" "$${GREEN}" "Global installation complete" "$${RESET}"; \
printf "\n"; \
printf "Tools installed to: ~/.local/bin\n"; \
printf "Make sure ~/.local/bin is in your PATH\n"; \
printf "\n"; \
printf "Available commands:\n"; \
printf " art-dashboard - ART-wide PI planning overview\n"; \
printf " team-deep-dive - Team capacity and risk analysis\n"; \
printf " objective-deep-dive - Objective details and assessment\n"; \
printf " release-status - PI progress tracking\n"; \
}
################################################################################
# GRADUATED TEST LADDER - Main Entry Point
################################################################################
## test: Run complete graduated test ladder (all phases in order)
## This is the ONLY command you need before pushing to CI
test:
@source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "🚀 Starting Graduated Test Ladder..." "$${RESET}"
@make test-structure
@make test-imports
@make test-format
@make test-lint
@make test-vet
@make test-types
@make test-complexity
@make test-security
@make test-unit
@make test-bdd
@make test-go
@source $(COLORS_SH) && printf "\n%s✓ %s%s\n" "$${GREEN}" "COMPLETE: All test levels passed!" "$${RESET}"
################################################################################
# PHASE 0: SYNTAX VALIDATION
################################################################################
## test-structure: Phase 0 - Python syntax validation (instant)
test-structure:
@source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "Phase 0: Validating Python syntax..." "$${RESET}"
@PATH="$(BIN_DIR):$$PATH" $(UV) run python -m py_compile tpcli_pi/**/*.py 2>/dev/null || true
@source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "Syntax validation passed" "$${RESET}"
################################################################################
# PHASE 0.25: IMPORT VALIDATION
################################################################################
## test-imports: Phase 0.25 - Check for broken imports (instant)
test-imports:
@source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "Phase 0.25: Checking for broken imports..." "$${RESET}"
@PATH="$(BIN_DIR):$$PATH" $(UV) run ruff check tpcli_pi/ --select F821 2>/dev/null || printf "%s⚠ %s%s\n" "$${YELLOW}" "No ruff available, skipping" "$${RESET}"
@source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "Import validation passed" "$${RESET}"
################################################################################
# PHASE 0.5: FORMAT CHECKING
################################################################################
## test-format: Phase 0.5 - Code formatting check (instant)
test-format:
@source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "Phase 0.5: Checking code formatting..." "$${RESET}"
@PATH="$(BIN_DIR):$$PATH" $(UV) run ruff format --check tpcli_pi/ tests/ 2>&1 || (source $(COLORS_SH) && printf "%s⚠ %s%s\n" "$${YELLOW}" "Code needs formatting. Run: make format-fix" "$${RESET}" && exit 1)
@source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "Code formatting check passed" "$${RESET}"
################################################################################
# PHASE 0.6: CODE LINTING (Python + Go)
################################################################################
## test-lint: Phase 0.6 - Code quality linting (Python + Go)
test-lint:
@source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "Phase 0.6: Checking code quality (Python + Go)..." "$${RESET}"
@PATH="$(BIN_DIR):$$PATH" $(UV) run ruff check tpcli_pi/ tests/ 2>/dev/null || (source $(COLORS_SH) && printf "%s⚠ %s%s\n" "$${YELLOW}" "Python linting: ruff not available" "$${RESET}")
@if command -v golangci-lint >/dev/null 2>&1; then \
golangci-lint run ./... || (source $(COLORS_SH) && printf "%s⚠ %s%s\n" "$${YELLOW}" "Go linting found issues (see above)" "$${RESET}" && exit 1); \
else \
source $(COLORS_SH) && printf "%s⚠ %s%s\n" "$${YELLOW}" "Go linting: golangci-lint not installed, skipping" "$${RESET}"; \
fi
@source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "Code quality checks complete" "$${RESET}"
################################################################################
# PHASE 0.7: GO VET
################################################################################
## test-vet: Phase 0.7 - Go vet checks
test-vet:
@source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "Phase 0.7: Running go vet..." "$${RESET}"
@$(GO) vet ./...
@source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "Go vet passed" "$${RESET}"
################################################################################
# PHASE 1: TYPE CHECKING
################################################################################
## test-types: Phase 1 - Type checking with mypy
test-types:
@source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "Phase 1: Type checking (mypy strict)..." "$${RESET}"
@PATH="$(BIN_DIR):$$PATH" $(UV) run mypy tpcli_pi/ || true
@source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "Type checking complete" "$${RESET}"
################################################################################
# PHASE 1.25: CODE COMPLEXITY (INFORMATIONAL ONLY - DOES NOT BLOCK)
################################################################################
## test-complexity: Phase 1.25 - Code complexity analysis (INFO ONLY)
test-complexity:
@source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "Phase 1.25: Analyzing code complexity (INFO ONLY)..." "$${RESET}"
@PATH="$(BIN_DIR):$$PATH" $(UV) run radon cc tpcli_pi/ -a -nb 2>/dev/null || (source $(COLORS_SH) && printf "%s⚠ %s%s\n" "$${YELLOW}" "radon not available, skipping" "$${RESET}")
@PATH="$(BIN_DIR):$$PATH" $(UV) run radon mi tpcli_pi/ -nb 2>/dev/null || (source $(COLORS_SH) && printf "%s⚠ %s%s\n" "$${YELLOW}" "radon MI not available, skipping" "$${RESET}")
@PATH="$(BIN_DIR):$$PATH" $(UV) run pylint --disable=all --enable=duplicate-code tpcli_pi/ 2>/dev/null || (source $(COLORS_SH) && printf "%s⚠ %s%s\n" "$${YELLOW}" "pylint not available, skipping" "$${RESET}")
@source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "Complexity analysis complete (info only)" "$${RESET}"
################################################################################
# PHASE 1.5: SECURITY SCANNING
################################################################################
## test-security: Phase 1.5 - Security scanning (bandit + semgrep)
test-security:
@source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "Phase 1.5: Running security scans..." "$${RESET}"
@PATH="$(BIN_DIR):$$PATH" $(UV) run bandit -r tpcli_pi/ -f json -o /tmp/bandit-report.json 2>/dev/null || (source $(COLORS_SH) && printf "%s⚠ %s%s\n" "$${YELLOW}" "bandit not available, skipping" "$${RESET}")
@PATH="$(BIN_DIR):$$PATH" $(UV) run semgrep --config=p/owasp-top-ten --json -o /tmp/semgrep-report.json tpcli_pi/ 2>/dev/null || (source $(COLORS_SH) && printf "%s⚠ %s%s\n" "$${YELLOW}" "semgrep not available, skipping" "$${RESET}")
@source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "Security scans complete" "$${RESET}"
################################################################################
# PHASE 2: PYTHON UNIT TESTS
################################################################################
## test-unit: Phase 2 - Python unit tests (pytest)
test-unit:
@source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "Phase 2: Running Python unit tests..." "$${RESET}"
@PATH="$(BIN_DIR):$$PATH" $(UV) run pytest -v tests/ 2>/dev/null || printf "%s⚠ %s%s\n" "$${YELLOW}" "pytest not available, skipping" "$${RESET}"
@source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "Python unit tests passed" "$${RESET}"
################################################################################
# PHASE 3: BDD TESTS
################################################################################
## test-bdd: Phase 3 - BDD feature tests (behave)
test-bdd:
@source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "Phase 3: Running BDD tests..." "$${RESET}"
@if [ -d "tests/features" ]; then \
PATH="$(BIN_DIR):$$PATH" $(UV) run behave tests/features/ --format progress --no-capture 2>/dev/null || printf "%s⚠ %s%s\n" "$${YELLOW}" "behave not available, skipping" "$${RESET}"; \
else \
source $(COLORS_SH) && printf "%s⚠ %s%s\n" "$${YELLOW}" "No BDD test features found in tests/features" "$${RESET}"; \
fi
@source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "BDD tests complete" "$${RESET}"
################################################################################
# PHASE 4: GO UNIT TESTS
################################################################################
## test-go: Phase 4 - Go unit tests
test-go:
@source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "Phase 4: Running Go unit tests..." "$${RESET}"
@$(GO) test -v ./... 2>/dev/null || printf "%s⚠ %s%s\n" "$${YELLOW}" "Go tests not available" "$${RESET}"
@source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "Go unit tests passed" "$${RESET}"
################################################################################
# ADDITIONAL TEST TARGETS
################################################################################
## test-cov: Run test ladder with coverage collection
test-cov:
@source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "Running test ladder with coverage collection..." "$${RESET}"
@source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "Note: Collecting coverage for Python tests only" "$${RESET}"
@PATH="$(BIN_DIR):$$PATH" $(UV) run pytest -v tests/ --cov=tpcli_pi --cov-report=html --cov-report=term-missing 2>/dev/null || true
@source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "Coverage report: htmlcov/index.html" "$${RESET}"
################################################################################
# CODE QUALITY & FORMATTING TARGETS
################################################################################
## format-fix: Auto-format code with ruff
format-fix:
source $(COLORS_SH) && { \
printf "%s%s%s\n" "$${BLUE}" "Formatting code..." "$${RESET}"; \
}
$(UV) run ruff format tpcli_pi/ tests/
source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "Code formatted" "$${RESET}"
## type-check: Alias for test-types (backwards compatibility)
type-check: test-types
## check: Quick check - lint + type-check only (not full ladder)
check:
@make test-lint
@make test-types
@source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "All checks passed" "$${RESET}"
################################################################################
# BUILD & UTILITY TARGETS
################################################################################
## build: Build the tpcli Go binary
build:
@source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "Building tpcli Go binary..." "$${RESET}"
@$(GO) build -o tpcli .
@source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "tpcli binary built successfully" "$${RESET}"
## clean: Remove virtual environment, binaries, and build artifacts
clean:
source $(COLORS_SH) && printf "%s%s%s\n" "$${BLUE}" "Cleaning up..." "$${RESET}"
rm -rf $(VENV_DIR)
rm -f $(TPCLI_BIN)
rm -rf build/ dist/ *.egg-info .eggs/
rm -rf .pytest_cache/ .mypy_cache/ .ruff_cache/
rm -rf htmlcov/ .coverage uv.lock
find . -type d -name __pycache__ -delete 2>/dev/null || true
source $(COLORS_SH) && printf "%s✓ %s%s\n" "$${GREEN}" "Cleanup complete" "$${RESET}"
## run: Run a command in venv (usage: make run CMD="art-dashboard --help")
run:
source $(COLORS_SH) && { \
if [[ -z "$${CMD:-}" ]]; then \
printf "Usage: make run CMD=\"<command>\"\n"; \
printf "Example: make run CMD=\"art-dashboard --art 'Example ART'\"\n"; \
exit 1; \
fi; \
}
PATH="$(BIN_DIR):$$PATH" $(UV) run $${CMD}
## docs: Show documentation location
docs:
source $(COLORS_SH) && { \
printf "%s%s%s\n" "$${BLUE}" "Documentation is in docs/ directory" "$${RESET}"; \
printf "Start with: %s%s%s\n" "$${GREEN}" "docs/QUICKSTART.md" "$${RESET}"; \
}
## show-config: Open tpcli global config in editor
show-config:
source $(COLORS_SH) && { \
if [[ ! -f "$$HOME/.config/tpcli/config.yaml" ]]; then \
printf "%s✗ %s%s\n" "$${RED}" "Error: tpcli config not found at ~/.config/tpcli/config.yaml" "$${RESET}" >&2; \
printf "Create it first with your TargetProcess credentials\n"; \
exit 1; \
fi; \
printf "%s%s%s\n" "$${BLUE}" "Opening tpcli config in $${EDITOR:-vi}" "$${RESET}"; \
}
$${EDITOR:-vi} "$$HOME/.config/tpcli/config.yaml"
## uat: User Acceptance Testing - test extensions work from any directory
uat:
source $(COLORS_SH) && { \
printf "%s%s%s\n" "$${BLUE}" "Running UAT: User Acceptance Tests" "$${RESET}"; \
printf "\n"; \
printf "%s%s%s\n" "$${GREEN}" "Step 1: Verify tpcli config exists" "$${RESET}"; \
if [[ ! -f "$$HOME/.config/tpcli/config.yaml" ]]; then \
printf "%s✗ %s%s\n" "$${RED}" "Error: tpcli config not found at ~/.config/tpcli/config.yaml" "$${RESET}" >&2; \
exit 1; \
fi; \
printf "✓ Config file found\n"; \
printf "\n"; \
printf "%s%s%s\n" "$${GREEN}" "Step 2: Test tpcli binary" "$${RESET}"; \
export PATH="$$HOME/.local/bin:$$PATH"; \
bash -c 'tpcli list Teams --take 1' > /tmp/uat-tpcli.out 2>&1 && printf "✓ tpcli authenticates\n" || (printf "✗ tpcli auth failed\n" && cat /tmp/uat-tpcli.out && exit 1); \
printf "\n"; \
printf "%s✓ %s%s\n" "$${GREEN}" "UAT Complete" "$${RESET}"; \
}
## all: Full setup - install-dev, check, test
all: install-dev check test
@source $(COLORS_SH) && printf "\n%s✓ %s%s\n" "$${GREEN}" "Complete: Installation, checks, and all tests passed!" "$${RESET}"
################################################################################
# PHONY TARGETS
################################################################################
.PHONY: help venv tpcli install install-dev install-global \
test test-structure test-imports test-format test-lint test-vet \
test-types test-complexity test-security test-unit test-bdd test-go \
test-cov format-fix type-check check build clean run docs show-config \
uat all