telemetry-kit 0.3.0

Privacy-first, batteries-included telemetry toolkit for Rust applications with OpenTelemetry
Documentation
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
# Makefile for telemetry-kit
# Comprehensive build, test, and development automation

# Colors and formatting
RESET := \033[0m
BOLD := \033[1m
RED := \033[31m
GREEN := \033[32m
YELLOW := \033[33m
BLUE := \033[34m
MAGENTA := \033[35m
CYAN := \033[36m

# Project info
PROJECT_NAME := telemetry-kit
VERSION := $(shell grep '^version' Cargo.toml | head -1 | cut -d '"' -f 2)

# Detect OS
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
    OS_TYPE := linux
endif
ifeq ($(UNAME_S),Darwin)
    OS_TYPE := macos
endif

# Default target
.DEFAULT_GOAL := help

##@ General

.PHONY: help
help: ## ๐Ÿ“š Show this help message
	@echo ""
	@echo "  $(BOLD)$(CYAN)๐Ÿ”ญ $(PROJECT_NAME) v$(VERSION)$(RESET)"
	@echo "  $(YELLOW)Privacy-first telemetry toolkit for Rust$(RESET)"
	@echo ""
	@awk 'BEGIN {FS = ":.*##"; printf "$(BOLD)Usage:$(RESET)\n  make $(CYAN)<target>$(RESET)\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf "  $(CYAN)%-20s$(RESET) %s\n", $$1, $$2 } /^##@/ { printf "\n$(BOLD)%s$(RESET)\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
	@echo ""

.PHONY: info
info: ## ๐Ÿ“‹ Show project information
	@echo "$(BOLD)$(CYAN)Project Information$(RESET)"
	@echo "  Name:    $(PROJECT_NAME)"
	@echo "  Version: $(VERSION)"
	@echo "  OS:      $(OS_TYPE)"
	@echo "  Rust:    $(shell rustc --version 2>/dev/null || echo 'not installed')"
	@echo "  Cargo:   $(shell cargo --version 2>/dev/null || echo 'not installed')"
	@echo ""

##@ Development

.PHONY: setup
setup: ## ๐Ÿš€ Setup development environment
	@echo "$(CYAN)๐Ÿš€ Setting up development environment...$(RESET)"
	@chmod +x scripts/*.sh
	@./scripts/dev-setup.sh

.PHONY: dev
dev: ## ๐Ÿ”„ Start development with auto-reload (requires cargo-watch)
	@echo "$(CYAN)๐Ÿ”„ Starting development mode with auto-reload...$(RESET)"
	@cargo watch -x 'test --lib' -x 'clippy'

.PHONY: build
build: ## ๐Ÿ”จ Build the project
	@echo "$(CYAN)๐Ÿ”จ Building project...$(RESET)"
	@cargo build
	@echo "$(GREEN)โœ… Build complete$(RESET)"

.PHONY: build-release
build-release: ## ๐Ÿš€ Build optimized release binary
	@echo "$(CYAN)๐Ÿš€ Building release binary...$(RESET)"
	@cargo build --release
	@echo "$(GREEN)โœ… Release build complete$(RESET)"
	@ls -lh target/release/$(PROJECT_NAME) 2>/dev/null || true

.PHONY: build-all
build-all: ## ๐Ÿ—๏ธ  Build all targets (lib, bins, examples)
	@echo "$(CYAN)๐Ÿ—๏ธ  Building all targets...$(RESET)"
	@cargo build --all-targets
	@echo "$(GREEN)โœ… All targets built$(RESET)"

.PHONY: clean
clean: ## ๐Ÿงน Clean build artifacts
	@echo "$(CYAN)๐Ÿงน Cleaning build artifacts...$(RESET)"
	@cargo clean
	@rm -rf coverage/
	@echo "$(GREEN)โœ… Clean complete$(RESET)"

##@ Testing

.PHONY: test
test: ## ๐Ÿงช Run all tests
	@echo "$(CYAN)๐Ÿงช Running tests...$(RESET)"
	@cargo test
	@echo "$(GREEN)โœ… Tests passed$(RESET)"

.PHONY: test-all
test-all: ## ๐Ÿ”ฌ Run comprehensive test suite (format, lint, test, doc)
	@echo "$(CYAN)๐Ÿ”ฌ Running comprehensive test suite...$(RESET)"
	@./scripts/test-all.sh

.PHONY: test-unit
test-unit: ## ๐Ÿงช Run unit tests only
	@echo "$(CYAN)๐Ÿงช Running unit tests...$(RESET)"
	@cargo test --lib
	@echo "$(GREEN)โœ… Unit tests passed$(RESET)"

.PHONY: test-integration
test-integration: ## ๐Ÿ”— Run integration tests
	@echo "$(CYAN)๐Ÿ”— Running integration tests...$(RESET)"
	@cargo test --test '*'
	@echo "$(GREEN)โœ… Integration tests passed$(RESET)"

.PHONY: test-doc
test-doc: ## ๐Ÿ“š Run documentation tests
	@echo "$(CYAN)๐Ÿ“š Running documentation tests...$(RESET)"
	@cargo test --doc
	@echo "$(GREEN)โœ… Doc tests passed$(RESET)"

.PHONY: test-watch
test-watch: ## ๐Ÿ‘€ Run tests in watch mode (requires cargo-watch)
	@echo "$(CYAN)๐Ÿ‘€ Watching for changes and running tests...$(RESET)"
	@cargo watch -x test

.PHONY: coverage
coverage: ## ๐Ÿ“Š Generate code coverage report
	@echo "$(CYAN)๐Ÿ“Š Generating code coverage...$(RESET)"
	@cargo tarpaulin --out Html --output-dir coverage
	@echo "$(GREEN)โœ… Coverage report generated: coverage/index.html$(RESET)"

##@ Code Quality

.PHONY: fmt
fmt: ## ๐ŸŽจ Format code
	@echo "$(CYAN)๐ŸŽจ Formatting code...$(RESET)"
	@cargo fmt
	@echo "$(GREEN)โœ… Code formatted$(RESET)"

.PHONY: fmt-check
fmt-check: ## ๐Ÿ” Check code formatting
	@echo "$(CYAN)๐Ÿ” Checking code formatting...$(RESET)"
	@cargo fmt -- --check
	@echo "$(GREEN)โœ… Formatting check passed$(RESET)"

.PHONY: lint
lint: ## ๐Ÿ” Run clippy lints
	@echo "$(CYAN)๐Ÿ” Running clippy lints...$(RESET)"
	@cargo clippy --all-features --all-targets -- -D warnings
	@echo "$(GREEN)โœ… Lints passed$(RESET)"

.PHONY: lint-fix
lint-fix: ## ๐Ÿ”ง Auto-fix clippy warnings
	@echo "$(CYAN)๐Ÿ”ง Auto-fixing clippy warnings...$(RESET)"
	@cargo clippy --fix --allow-dirty --allow-staged
	@echo "$(GREEN)โœ… Fixes applied$(RESET)"

.PHONY: check
check: ## โœ… Run cargo check
	@echo "$(CYAN)โœ… Running cargo check...$(RESET)"
	@cargo check --all-features --all-targets
	@echo "$(GREEN)โœ… Check passed$(RESET)"

##@ Documentation

.PHONY: doc
doc: ## ๐Ÿ“– Build documentation
	@echo "$(CYAN)๐Ÿ“– Building documentation...$(RESET)"
	@cargo doc --no-deps --document-private-items
	@echo "$(GREEN)โœ… Documentation built$(RESET)"

.PHONY: doc-open
doc-open: ## ๐ŸŒ Build and open documentation in browser
	@echo "$(CYAN)๐ŸŒ Building and opening documentation...$(RESET)"
	@cargo doc --no-deps --document-private-items --open

.PHONY: doc-check
doc-check: ## ๐Ÿ” Check documentation for warnings
	@echo "$(CYAN)๐Ÿ” Checking documentation...$(RESET)"
	@RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --document-private-items
	@echo "$(GREEN)โœ… Documentation check passed$(RESET)"

##@ Security

.PHONY: audit
audit: ## ๐Ÿ”’ Run security audit
	@echo "$(CYAN)๐Ÿ”’ Running security audit...$(RESET)"
	@cargo audit
	@echo "$(GREEN)โœ… Security audit complete$(RESET)"

.PHONY: deny-check
deny-check: ## ๐Ÿšซ Check dependency policy
	@echo "$(CYAN)๐Ÿšซ Checking dependency policy...$(RESET)"
	@cargo deny check
	@echo "$(GREEN)โœ… Dependency policy check passed$(RESET)"

.PHONY: outdated
outdated: ## ๐Ÿ“ฆ Check for outdated dependencies
	@echo "$(CYAN)๐Ÿ“ฆ Checking for outdated dependencies...$(RESET)"
	@cargo outdated
	@echo "$(GREEN)โœ… Outdated check complete$(RESET)"

.PHONY: update
update: ## ๐Ÿ”„ Update dependencies
	@echo "$(CYAN)๐Ÿ”„ Updating dependencies...$(RESET)"
	@cargo update
	@echo "$(GREEN)โœ… Dependencies updated$(RESET)"

##@ Examples

.PHONY: example-basic
example-basic: ## ๐ŸŽฏ Run basic example
	@echo "$(CYAN)๐ŸŽฏ Running basic example...$(RESET)"
	@cargo run --example basic

.PHONY: example-local
example-local: ## ๐Ÿ’พ Run local-only example
	@echo "$(CYAN)๐Ÿ’พ Running local-only example...$(RESET)"
	@cargo run --example local_only

.PHONY: example-sync
example-sync: ## ๐Ÿ”„ Run sync example
	@echo "$(CYAN)๐Ÿ”„ Running sync example...$(RESET)"
	@cargo run --example sync_example

.PHONY: example-e2e
example-e2e: ## ๐ŸŒ Run end-to-end sync test
	@echo "$(CYAN)๐ŸŒ Running end-to-end sync test...$(RESET)"
	@echo "$(YELLOW)โš ๏ธ  Make sure server is running: cd server && docker compose up -d$(RESET)"
	@cargo run --example e2e_sync_test

.PHONY: examples
examples: ## ๐Ÿ“ฆ Build all examples
	@echo "$(CYAN)๐Ÿ“ฆ Building all examples...$(RESET)"
	@cargo build --examples
	@echo "$(GREEN)โœ… All examples built$(RESET)"

##@ Server

.PHONY: server-up
server-up: ## ๐Ÿš€ Start the server (Docker Compose)
	@echo "$(CYAN)๐Ÿš€ Starting server...$(RESET)"
	@cd server && docker compose up -d
	@echo "$(GREEN)โœ… Server started$(RESET)"
	@echo "$(YELLOW)๐ŸŒ Server running at http://localhost:8080$(RESET)"

.PHONY: server-down
server-down: ## โฌ‡๏ธ  Stop the server
	@echo "$(CYAN)โฌ‡๏ธ  Stopping server...$(RESET)"
	@cd server && docker compose down
	@echo "$(GREEN)โœ… Server stopped$(RESET)"

.PHONY: server-logs
server-logs: ## ๐Ÿ“‹ Show server logs
	@echo "$(CYAN)๐Ÿ“‹ Server logs (Ctrl+C to exit):$(RESET)"
	@cd server && docker compose logs -f

.PHONY: server-restart
server-restart: ## ๐Ÿ”„ Restart the server
	@echo "$(CYAN)๐Ÿ”„ Restarting server...$(RESET)"
	@cd server && docker compose restart
	@echo "$(GREEN)โœ… Server restarted$(RESET)"

.PHONY: server-build
server-build: ## ๐Ÿ”จ Build server Docker image
	@echo "$(CYAN)๐Ÿ”จ Building server Docker image...$(RESET)"
	@cd server && docker compose build
	@echo "$(GREEN)โœ… Server image built$(RESET)"

.PHONY: server-clean
server-clean: ## ๐Ÿงน Clean server data (stop + remove volumes)
	@echo "$(CYAN)๐Ÿงน Cleaning server data...$(RESET)"
	@cd server && docker compose down -v
	@echo "$(GREEN)โœ… Server data cleaned$(RESET)"

##@ Synchronization

.PHONY: check-sync
check-sync: ## ๐Ÿ”„ Check schema sync between repos
	@echo "$(CYAN)๐Ÿ”„ Checking schema synchronization...$(RESET)"
	@./scripts/check-sync.sh

.PHONY: sync-status
sync-status: ## ๐Ÿ“Š Show sync status
	@echo "$(CYAN)๐Ÿ“Š Sync status:$(RESET)"
	@echo ""
	@echo "$(BOLD)Public Repo:$(RESET)  $(shell pwd)"
	@echo "  Version: $(VERSION)"
	@echo "  Schema:  $(shell grep -o 'SCHEMA_VERSION.*=.*"[0-9.]*"' src/event.rs | grep -o '[0-9.]*' || echo 'unknown')"
	@echo ""
	@if [ -d "$$HOME/Dev/telemetry-kit.dev" ]; then \
		echo "$(BOLD)Private Repo:$(RESET) $$HOME/Dev/telemetry-kit.dev"; \
		echo "  Status:  Found โœ…"; \
	else \
		echo "$(BOLD)Private Repo:$(RESET) Not found โš ๏ธ"; \
	fi
	@echo ""

##@ Git & Release

.PHONY: git-status
git-status: ## ๐Ÿ“Š Show git status with emoji
	@echo "$(CYAN)๐Ÿ“Š Git status:$(RESET)"
	@git status

.PHONY: commit-phase1
commit-phase1: ## ๐Ÿ’พ Commit Phase 1 changes
	@echo "$(CYAN)๐Ÿ’พ Committing Phase 1 changes...$(RESET)"
	@git add .
	@git commit -m "feat: Phase 1 complete - foundation & infrastructure\n\nBREAKING CHANGE: Version bump from 0.0.1 to 0.2.0-alpha.1\n\nThis is the first functional alpha release with working SDK and\nsync protocol. Not suitable for production use yet.\n\nInfrastructure:\n- CI/CD pipeline fixed and enhanced (6 jobs)\n- Security scanning and vulnerability disclosure\n- Development tooling and helper scripts\n- Comprehensive documentation and roadmap\n\nSee PRODUCTION_PLAN.md for roadmap to v1.0.0."
	@echo "$(GREEN)โœ… Changes committed$(RESET)"
	@echo "$(YELLOW)๐Ÿ’ก Run 'make push' to push to remote$(RESET)"

.PHONY: push
push: ## โฌ†๏ธ  Push to remote
	@echo "$(CYAN)โฌ†๏ธ  Pushing to remote...$(RESET)"
	@git push origin main
	@echo "$(GREEN)โœ… Pushed to remote$(RESET)"

.PHONY: tag
tag: ## ๐Ÿท๏ธ  Create and push version tag
	@echo "$(CYAN)๐Ÿท๏ธ  Creating tag v$(VERSION)...$(RESET)"
	@git tag -a v$(VERSION) -m "Release v$(VERSION)"
	@git push origin v$(VERSION)
	@echo "$(GREEN)โœ… Tag v$(VERSION) created and pushed$(RESET)"

##@ Publishing

# Get macros version
MACROS_VERSION := $(shell grep '^version' telemetry-kit-macros/Cargo.toml | head -1 | cut -d '"' -f 2)

.PHONY: publish-check
publish-check: ## โœ… Check if ready to publish
	@echo "$(CYAN)โœ… Checking if ready to publish...$(RESET)"
	@cargo publish --dry-run
	@echo "$(GREEN)โœ… Publish check passed$(RESET)"

.PHONY: publish-macros-check
publish-macros-check: ## โœ… Check if macros crate is ready to publish
	@echo "$(CYAN)โœ… Checking macros crate...$(RESET)"
	@cargo publish -p telemetry-kit-macros --dry-run
	@echo "$(GREEN)โœ… Macros publish check passed$(RESET)"

.PHONY: publish-macros
publish-macros: ## ๐Ÿ“ฆ Publish telemetry-kit-macros to crates.io
	@echo "$(CYAN)๐Ÿ“ฆ Publishing telemetry-kit-macros v$(MACROS_VERSION) to crates.io...$(RESET)"
	@echo "$(YELLOW)โš ๏ธ  This will publish telemetry-kit-macros v$(MACROS_VERSION)$(RESET)"
	@read -p "Continue? [y/N] " -n 1 -r; \
	echo; \
	if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
		cargo publish -p telemetry-kit-macros; \
		echo "$(GREEN)โœ… telemetry-kit-macros published$(RESET)"; \
	else \
		echo "$(YELLOW)โŒ Publish cancelled$(RESET)"; \
	fi

.PHONY: publish
publish: ## ๐Ÿ“ฆ Publish telemetry-kit to crates.io
	@echo "$(CYAN)๐Ÿ“ฆ Publishing to crates.io...$(RESET)"
	@echo "$(YELLOW)โš ๏ธ  This will publish version $(VERSION) to crates.io$(RESET)"
	@read -p "Continue? [y/N] " -n 1 -r; \
	echo; \
	if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
		cargo publish; \
		echo "$(GREEN)โœ… Published to crates.io$(RESET)"; \
	else \
		echo "$(YELLOW)โŒ Publish cancelled$(RESET)"; \
	fi

.PHONY: publish-all
publish-all: ## ๐Ÿš€ Publish all crates in correct order (macros first, then main)
	@echo "$(BOLD)$(CYAN)๐Ÿš€ Publishing all crates to crates.io$(RESET)"
	@echo ""
	@echo "$(BOLD)Step 1: Sync versions$(RESET)"
	@echo "  Main crate:   v$(VERSION)"
	@echo "  Macros crate: v$(MACROS_VERSION)"
	@echo ""
	@if [ "$(VERSION)" != "$(MACROS_VERSION)" ]; then \
		echo "$(RED)โŒ Version mismatch! Please ensure both crates have the same version.$(RESET)"; \
		echo "$(YELLOW)   Update telemetry-kit-macros/Cargo.toml version to $(VERSION)$(RESET)"; \
		exit 1; \
	fi
	@echo "$(GREEN)โœ… Versions match$(RESET)"
	@echo ""
	@echo "$(BOLD)Step 2: Pre-publish checks$(RESET)"
	@cargo publish -p telemetry-kit-macros --dry-run
	@echo "$(GREEN)โœ… Macros crate ready$(RESET)"
	@echo ""
	@echo "$(BOLD)Step 3: Publish telemetry-kit-macros$(RESET)"
	@echo "$(YELLOW)โš ๏ธ  About to publish telemetry-kit-macros v$(VERSION) to crates.io$(RESET)"
	@read -p "Publish macros crate? [y/N] " -n 1 -r; \
	echo; \
	if [[ ! $$REPLY =~ ^[Yy]$$ ]]; then \
		echo "$(YELLOW)โŒ Publish cancelled$(RESET)"; \
		exit 1; \
	fi
	@cargo publish -p telemetry-kit-macros
	@echo "$(GREEN)โœ… telemetry-kit-macros v$(VERSION) published$(RESET)"
	@echo ""
	@echo "$(BOLD)Step 4: Wait for crates.io to index (30 seconds)...$(RESET)"
	@echo "$(YELLOW)โณ Waiting for crates.io to index the macros crate...$(RESET)"
	@sleep 30
	@echo "$(GREEN)โœ… Wait complete$(RESET)"
	@echo ""
	@echo "$(BOLD)Step 5: Publish telemetry-kit$(RESET)"
	@echo "$(YELLOW)โš ๏ธ  About to publish telemetry-kit v$(VERSION) to crates.io$(RESET)"
	@read -p "Publish main crate? [y/N] " -n 1 -r; \
	echo; \
	if [[ ! $$REPLY =~ ^[Yy]$$ ]]; then \
		echo "$(YELLOW)โŒ Publish cancelled$(RESET)"; \
		exit 1; \
	fi
	@cargo publish
	@echo ""
	@echo "$(GREEN)$(BOLD)๐ŸŽ‰ All crates published successfully!$(RESET)"
	@echo ""
	@echo "  ๐Ÿ“ฆ telemetry-kit-macros v$(VERSION)"
	@echo "  ๐Ÿ“ฆ telemetry-kit v$(VERSION)"
	@echo ""
	@echo "$(CYAN)View on crates.io:$(RESET)"
	@echo "  https://crates.io/crates/telemetry-kit-macros"
	@echo "  https://crates.io/crates/telemetry-kit"
	@echo ""

.PHONY: publish-status
publish-status: ## ๐Ÿ“Š Show publish status and version info
	@echo "$(BOLD)$(CYAN)๐Ÿ“Š Publish Status$(RESET)"
	@echo ""
	@echo "$(BOLD)Local versions:$(RESET)"
	@echo "  telemetry-kit:        v$(VERSION)"
	@echo "  telemetry-kit-macros: v$(MACROS_VERSION)"
	@echo ""
	@if [ "$(VERSION)" = "$(MACROS_VERSION)" ]; then \
		echo "$(GREEN)โœ… Versions are in sync$(RESET)"; \
	else \
		echo "$(RED)โŒ Version mismatch - sync before publishing$(RESET)"; \
	fi
	@echo ""
	@echo "$(BOLD)Crates.io status:$(RESET)"
	@echo "  Check: https://crates.io/crates/telemetry-kit"
	@echo "  Check: https://crates.io/crates/telemetry-kit-macros"
	@echo ""

.PHONY: version-sync
version-sync: ## ๐Ÿ”„ Sync macros version to match main crate version
	@echo "$(CYAN)๐Ÿ”„ Syncing versions...$(RESET)"
	@echo "  Main crate version: $(VERSION)"
	@echo "  Updating telemetry-kit-macros to v$(VERSION)..."
	@sed -i '' 's/^version = ".*"/version = "$(VERSION)"/' telemetry-kit-macros/Cargo.toml
	@echo "$(GREEN)โœ… Macros version updated to $(VERSION)$(RESET)"
	@echo ""
	@echo "$(YELLOW)๐Ÿ“ Also update the dependency version in main Cargo.toml:$(RESET)"
	@grep "telemetry-kit-macros" Cargo.toml
	@echo ""

##@ Benchmarking

.PHONY: bench
bench: ## ๐Ÿ“ˆ Run benchmarks
	@echo "$(CYAN)๐Ÿ“ˆ Running benchmarks...$(RESET)"
	@cargo bench
	@echo "$(GREEN)โœ… Benchmarks complete$(RESET)"

##@ CI/CD Simulation

.PHONY: ci
ci: fmt-check lint test doc-check ## ๐Ÿค– Simulate CI pipeline locally
	@echo ""
	@echo "$(GREEN)โœ… CI simulation passed$(RESET)"

.PHONY: ci-full
ci-full: fmt-check lint test doc-check audit deny-check ## ๐Ÿš€ Full CI pipeline with security checks
	@echo ""
	@echo "$(GREEN)โœ… Full CI simulation passed$(RESET)"

##@ Utilities

.PHONY: install-tools
install-tools: ## ๐Ÿ› ๏ธ  Install development tools
	@echo "$(CYAN)๐Ÿ› ๏ธ  Installing development tools...$(RESET)"
	@cargo install cargo-audit cargo-deny cargo-tarpaulin cargo-watch cargo-outdated
	@echo "$(GREEN)โœ… Tools installed$(RESET)"

.PHONY: deps
deps: ## ๐Ÿ“ฆ Show dependency tree
	@echo "$(CYAN)๐Ÿ“ฆ Dependency tree:$(RESET)"
	@cargo tree

.PHONY: bloat
bloat: ## ๐Ÿ“Š Analyze binary size (requires cargo-bloat)
	@echo "$(CYAN)๐Ÿ“Š Analyzing binary size...$(RESET)"
	@cargo bloat --release

.PHONY: lines
lines: ## ๐Ÿ“ Count lines of code
	@echo "$(CYAN)๐Ÿ“ Lines of code:$(RESET)"
	@echo ""
	@echo "$(BOLD)Source code:$(RESET)"
	@find src -name '*.rs' | xargs wc -l | tail -1
	@echo ""
	@echo "$(BOLD)Server code:$(RESET)"
	@find server/src -name '*.rs' 2>/dev/null | xargs wc -l 2>/dev/null | tail -1 || echo "  N/A"
	@echo ""
	@echo "$(BOLD)Tests:$(RESET)"
	@find tests -name '*.rs' 2>/dev/null | xargs wc -l 2>/dev/null | tail -1 || echo "  N/A"
	@echo ""
	@echo "$(BOLD)Total:$(RESET)"
	@find . -name '*.rs' -not -path "./target/*" -not -path "./server/target/*" | xargs wc -l | tail -1

.PHONY: todos
todos: ## ๐Ÿ“ Find TODO comments in code
	@echo "$(CYAN)๐Ÿ“ TODO comments:$(RESET)"
	@grep -rn "TODO\|FIXME\|XXX\|HACK" src/ --color=always || echo "  None found โœ…"

##@ Workspace

.PHONY: workspace-build
workspace-build: ## ๐Ÿ—๏ธ  Build entire workspace
	@echo "$(CYAN)๐Ÿ—๏ธ  Building workspace...$(RESET)"
	@cargo build --workspace
	@echo "$(GREEN)โœ… Workspace built$(RESET)"

.PHONY: workspace-test
workspace-test: ## ๐Ÿงช Test entire workspace
	@echo "$(CYAN)๐Ÿงช Testing workspace...$(RESET)"
	@cargo test --workspace
	@echo "$(GREEN)โœ… Workspace tests passed$(RESET)"

.PHONY: workspace-clean
workspace-clean: ## ๐Ÿงน Clean entire workspace
	@echo "$(CYAN)๐Ÿงน Cleaning workspace...$(RESET)"
	@cargo clean
	@cd server && cargo clean
	@echo "$(GREEN)โœ… Workspace cleaned$(RESET)"

##@ Quick Commands

.PHONY: quick-test
quick-test: fmt lint test ## โšก Quick test (format + lint + test)
	@echo ""
	@echo "$(GREEN)โœ… Quick test passed$(RESET)"

.PHONY: quick-fix
quick-fix: fmt lint-fix ## ๐Ÿ”ง Quick fix (format + auto-fix lints)
	@echo ""
	@echo "$(GREEN)โœ… Code fixed$(RESET)"

.PHONY: pre-commit
pre-commit: fmt-check lint test ## โœ… Pre-commit checks
	@echo ""
	@echo "$(GREEN)โœ… Pre-commit checks passed$(RESET)"

.PHONY: pre-push
pre-push: ci ## ๐Ÿš€ Pre-push checks (full CI simulation)
	@echo ""
	@echo "$(GREEN)โœ… Pre-push checks passed$(RESET)"

##@ Special

.PHONY: ascii-art
ascii-art: ## ๐ŸŽจ Show project ASCII art
	@echo ""
	@echo "$(CYAN)"
	@echo "  โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—"
	@echo "  โ•‘                                            โ•‘"
	@echo "  โ•‘         ๐Ÿ”ญ  telemetry-kit  ๐Ÿ”ญ              โ•‘"
	@echo "  โ•‘                                            โ•‘"
	@echo "  โ•‘   Privacy-first telemetry for Rust apps   โ•‘"
	@echo "  โ•‘                                            โ•‘"
	@echo "  โ•‘              Version $(VERSION)              โ•‘"
	@echo "  โ•‘                                            โ•‘"
	@echo "  โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•"
	@echo "$(RESET)"
	@echo ""

.PHONY: coffee
coffee: ## โ˜• Take a break reminder
	@echo ""
	@echo "$(YELLOW)โ˜• Time for a coffee break!$(RESET)"
	@echo "$(CYAN)You've been working hard. Take 5 minutes.$(RESET)"
	@echo ""
	@sleep 1
	@echo "$(GREEN)โœ… Back to coding in 5... 4... 3... 2... 1...$(RESET)"
	@echo ""

.PHONY: stats
stats: ## ๐Ÿ“Š Show project statistics
	@echo "$(BOLD)$(CYAN)๐Ÿ“Š Project Statistics$(RESET)"
	@echo ""
	@echo "$(BOLD)Version:$(RESET)      $(VERSION)"
	@echo "$(BOLD)Rust Files:$(RESET)   $(shell find src -name '*.rs' | wc -l | xargs)"
	@echo "$(BOLD)Lines of Code:$(RESET) $(shell find src -name '*.rs' | xargs wc -l | tail -1 | awk '{print $$1}')"
	@echo "$(BOLD)Tests:$(RESET)        $(shell grep -r "^#\[test\]" src tests 2>/dev/null | wc -l | xargs)"
	@echo "$(BOLD)Examples:$(RESET)     $(shell ls examples/*.rs 2>/dev/null | wc -l | xargs)"
	@echo "$(BOLD)Dependencies:$(RESET) $(shell cargo tree --depth 1 | grep -v "telemetry" | wc -l | xargs)"
	@echo "$(BOLD)Git Commits:$(RESET)  $(shell git rev-list --count HEAD 2>/dev/null || echo 'N/A')"
	@echo ""

# Phony targets declaration
.PHONY: all
all: build test ## ๐ŸŽฏ Build and test (default: use 'make help')
	@echo "$(GREEN)โœ… Build and test complete$(RESET)"