windjammer 0.41.0

A simple language inspired by Go, Ruby, and Elixir that transpiles to Rust - 80% of Rust's power with 20% of the complexity
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
.PHONY: help test test-all test-stdlib test-ui test-game test-integration \
        test-quick test-verbose clippy fmt check build build-all \
        example-ui example-game example-http example-physics example-audio \
        test-examples clean doc setup-hooks check-versions

# Default target
help:
	@echo "Windjammer - Development Commands"
	@echo ""
	@echo "Setup:"
	@echo "  make setup-hooks       - Install git hooks (version checks)"
	@echo "  make check-versions    - Check version consistency across crates"
	@echo ""
	@echo "Testing:"
	@echo "  make test              - Run all tests"
	@echo "  make test-quick        - Quick test (stdlib smoke test only)"
	@echo "  make test-stdlib       - Test standard library"
	@echo "  make test-ui           - Test UI framework"
	@echo "  make test-game         - Test game engine"
	@echo "  make test-integration  - Integration tests only"
	@echo "  make test-verbose      - Run tests with output"
	@echo "  make test-examples     - Run all example tests"
	@echo ""
	@echo "Code Quality:"
	@echo "  make check             - Run all checks (fmt + clippy + test)"
	@echo "  make fmt               - Format code"
	@echo "  make clippy            - Run clippy linter"
	@echo ""
	@echo "Building:"
	@echo "  make build             - Build main compiler"
	@echo "  make build-all         - Build all crates"
	@echo "  make doc               - Generate documentation"
	@echo ""
	@echo "Examples:"
	@echo "  make example-ui        - Run UI counter demo"
	@echo "  make example-game      - Run game app test"
	@echo "  make example-http      - Run HTTP server test"
	@echo "  make example-physics   - Run physics test"
	@echo "  make example-audio     - Run audio test"
	@echo ""
	@echo "Cleanup:"
	@echo "  make clean             - Clean build artifacts"

# =============================================================================
# Testing
# =============================================================================

# Run all tests
test:
	@echo "๐Ÿงช Running all tests..."
	cargo test --all-features --workspace

# Run all tests with nocapture
test-verbose:
	@echo "๐Ÿงช Running all tests (verbose)..."
	cargo test --all-features --workspace -- --nocapture

# Quick smoke test
test-quick:
	@echo "๐Ÿงช Quick smoke test..."
	cargo test -p windjammer-runtime --test smoke_test

# Test standard library
test-stdlib:
	@echo "๐Ÿงช Testing standard library..."
	cargo test -p windjammer-runtime --all-features

# Test stdlib integration tests
test-stdlib-integration:
	@echo "๐Ÿงช Testing stdlib integration..."
	cargo test -p windjammer-runtime --test integration_tests

# Test stdlib smoke tests
test-stdlib-smoke:
	@echo "๐Ÿงช Testing stdlib smoke tests..."
	cargo test -p windjammer-runtime --test smoke_test

# Test individual stdlib modules
test-stdlib-http:
	@echo "๐Ÿงช Testing std::http..."
	cargo test -p windjammer-runtime http

test-stdlib-db:
	@echo "๐Ÿงช Testing std::db..."
	cargo test -p windjammer-runtime db

test-stdlib-json:
	@echo "๐Ÿงช Testing std::json..."
	cargo test -p windjammer-runtime json

test-stdlib-fs:
	@echo "๐Ÿงช Testing std::fs..."
	cargo test -p windjammer-runtime fs

# Test UI framework
test-ui:
	@echo "๐Ÿงช Testing UI framework..."
	cargo test -p windjammer-ui --all-features

# Test UI components
test-ui-vdom:
	@echo "๐Ÿงช Testing UI VDOM..."
	cargo test -p windjammer-ui vdom

test-ui-reactivity:
	@echo "๐Ÿงช Testing UI reactivity..."
	cargo test -p windjammer-ui reactivity

test-ui-renderer:
	@echo "๐Ÿงช Testing UI renderer..."
	cargo test -p windjammer-ui simple_renderer

# Test game engine
test-game:
	@echo "๐Ÿงช Testing game engine..."
	cargo test -p windjammer-game --all-features

# Test game components
test-game-ecs:
	@echo "๐Ÿงช Testing game ECS..."
	cargo test -p windjammer-game ecs

test-game-physics:
	@echo "๐Ÿงช Testing game physics..."
	cargo test -p windjammer-game physics --features 3d

test-game-rendering:
	@echo "๐Ÿงช Testing game rendering..."
	cargo test -p windjammer-game rendering

test-game-audio:
	@echo "๐Ÿงช Testing game audio..."
	cargo test -p windjammer-game audio --features audio

# Test compiler
test-compiler:
	@echo "๐Ÿงช Testing compiler..."
	cargo test -p windjammer

# Test LSP
test-lsp:
	@echo "๐Ÿงช Testing LSP..."
	cargo test -p windjammer-lsp

# Test MCP
test-mcp:
	@echo "๐Ÿงช Testing MCP..."
	cargo test -p windjammer-mcp

# Integration tests
test-integration:
	@echo "๐Ÿงช Running integration tests..."
	cargo test --test '*' --workspace

# =============================================================================
# Code Quality
# =============================================================================

# Run all quality checks
check: fmt clippy test
	@echo "โœ… All checks passed!"

# Format code
fmt:
	@echo "๐Ÿ“ Formatting code..."
	cargo fmt --all

# Check formatting without modifying
fmt-check:
	@echo "๐Ÿ“ Checking code formatting..."
	cargo fmt --all -- --check

# Run clippy
clippy:
	@echo "๐Ÿ“Ž Running clippy..."
	cargo clippy --all-features --workspace -- -D warnings

# Run clippy on specific crate
clippy-compiler:
	@echo "๐Ÿ“Ž Clippy: windjammer..."
	cargo clippy -p windjammer --all-features -- -D warnings

clippy-lsp:
	@echo "๐Ÿ“Ž Clippy: windjammer-lsp..."
	cargo clippy -p windjammer-lsp --all-features -- -D warnings

clippy-mcp:
	@echo "๐Ÿ“Ž Clippy: windjammer-mcp..."
	cargo clippy -p windjammer-mcp --all-features -- -D warnings

clippy-ui:
	@echo "๐Ÿ“Ž Clippy: windjammer-ui..."
	cargo clippy -p windjammer-ui --all-features -- -D warnings

clippy-game:
	@echo "๐Ÿ“Ž Clippy: windjammer-game..."
	cargo clippy -p windjammer-game --all-features -- -D warnings

# =============================================================================
# Building
# =============================================================================

# Build main compiler
build:
	@echo "๐Ÿ”จ Building compiler..."
	cargo build --release

# Build all crates
build-all:
	@echo "๐Ÿ”จ Building all crates..."
	cargo build --all-features --workspace --release

# Build debug
build-debug:
	@echo "๐Ÿ”จ Building (debug)..."
	cargo build --all-features --workspace

# Build examples
build-examples:
	@echo "๐Ÿ”จ Building examples..."
	cargo build --examples --all-features --workspace

# Generate documentation
doc:
	@echo "๐Ÿ“š Generating documentation..."
	cargo doc --all-features --workspace --no-deps --open

# Generate documentation without opening
doc-quiet:
	@echo "๐Ÿ“š Generating documentation..."
	cargo doc --all-features --workspace --no-deps

# =============================================================================
# Examples
# =============================================================================

# Run all example tests
test-examples: example-ui example-physics example-audio example-game
	@echo "โœ… All examples completed!"

# UI counter demo
example-ui:
	@echo "๐ŸŽจ Running UI counter demo..."
	cargo run --example counter_test -p windjammer-ui

# Game app test
example-game:
	@echo "๐ŸŽฎ Running game app test..."
	cargo run --example game_app_test -p windjammer-game --features "3d,audio" 2>/dev/null || \
	cargo run --example game_app_test -p windjammer-game --features "3d"

# Physics test
example-physics:
	@echo "โš™๏ธ  Running physics test..."
	cargo run --example physics_test -p windjammer-game --features 3d

# Audio test  
example-audio:
	@echo "๐Ÿ”Š Running audio test..."
	cargo run --example audio_test -p windjammer-game --features audio 2>/dev/null || \
	echo "โš ๏ธ  Audio feature requires audio hardware"

# Rendering test
example-rendering:
	@echo "๐ŸŽจ Running rendering test..."
	cargo run --example rendering_test -p windjammer-game

# Window test (desktop)
example-window:
	@echo "๐ŸชŸ Running window test..."
	cargo run --example window_test -p windjammer-ui --features desktop

# HTTP server test (requires creating example first)
example-http:
	@echo "๐ŸŒ HTTP server example..."
	@echo "To test HTTP server:"
	@echo "  1. cargo run -- examples/serve_ui_wasm.wj"
	@echo "  2. curl http://127.0.0.1:8080/"

# =============================================================================
# Benchmarks
# =============================================================================

bench:
	@echo "โšก Running benchmarks..."
	cargo bench --workspace

bench-compiler:
	@echo "โšก Benchmarking compiler..."
	cargo bench -p windjammer

# =============================================================================
# Cleanup
# =============================================================================

# Clean build artifacts
clean:
	@echo "๐Ÿงน Cleaning build artifacts..."
	cargo clean

# Clean and rebuild
rebuild: clean build-all

# =============================================================================
# Development Workflow
# =============================================================================

# Pre-commit checks (mimics pre-commit hook)
pre-commit: fmt-check clippy test
	@echo "โœ… Pre-commit checks passed!"

# Quick development cycle
dev: fmt clippy test-quick
	@echo "โœ… Quick dev cycle complete!"

# Full CI simulation
ci: fmt-check clippy test build-all
	@echo "โœ… CI checks complete!"

# Watch and test (requires cargo-watch)
watch:
	@echo "๐Ÿ‘€ Watching for changes..."
	cargo watch -x "test --all-features"

# Watch specific crate
watch-stdlib:
	cargo watch -x "test -p windjammer-runtime"

watch-ui:
	cargo watch -x "test -p windjammer-ui"

watch-game:
	cargo watch -x "test -p windjammer-game"

# =============================================================================
# Release
# =============================================================================

# Prepare release
release-check: check doc
	@echo "โœ… Release ready!"
	@echo ""
	@echo "Next steps:"
	@echo "  1. Review CHANGELOG.md"
	@echo "  2. git commit -am 'chore: prepare release'"
	@echo "  3. git push origin feature-branch"
	@echo "  4. Create pull request"

# Show project stats
stats:
	@echo "๐Ÿ“Š Project Statistics"
	@echo "====================="
	@echo ""
	@echo "Lines of code:"
	@find src crates -name '*.rs' | xargs wc -l | tail -1
	@echo ""
	@echo "Test count:"
	@cargo test --workspace --all-features -- --list 2>/dev/null | grep -c "test " || echo "Run 'make test' first"
	@echo ""
	@echo "Crates:"
	@ls -1 crates/ | wc -l
	@echo ""
	@echo "Dependencies:"
	@cargo tree --workspace --depth 1 | wc -l

# Show version info
version:
	@echo "Windjammer Version Info"
	@echo "======================="
	@grep '^version' Cargo.toml | head -1
	@echo ""
	@echo "Crate versions:"
	@for crate in windjammer-lsp windjammer-mcp windjammer-ui windjammer-game windjammer-runtime; do \
		echo -n "  $$crate: "; \
		grep '^version' crates/$$crate/Cargo.toml | head -1 | cut -d'"' -f2; \
	done

# =============================================================================
# Advanced Testing
# =============================================================================

# Test with specific features
test-wasm:
	@echo "๐Ÿงช Testing WASM target..."
	cargo test --target wasm32-unknown-unknown -p windjammer-ui

# Test with minimal features
test-minimal:
	@echo "๐Ÿงช Testing minimal features..."
	cargo test --no-default-features

# Memory leak detection (requires valgrind)
test-memory:
	@echo "๐Ÿงช Memory leak detection..."
	@which valgrind > /dev/null || (echo "โŒ valgrind not installed" && exit 1)
	cargo build --tests
	valgrind --leak-check=full --show-leak-kinds=all \
		target/debug/deps/windjammer-* --test-threads=1

# =============================================================================
# Utilities
# =============================================================================

# Count TODOs in codebase
todos:
	@echo "๐Ÿ“ TODOs in codebase:"
	@grep -r "TODO" src crates --include="*.rs" | wc -l

# Find TODOs with context
todos-list:
	@echo "๐Ÿ“ TODO items:"
	@grep -rn "TODO" src crates --include="*.rs"

# Show recent changes
changes:
	@echo "๐Ÿ“ Recent commits:"
	@git log --oneline -10

# Show current branch
branch:
	@echo "Current branch: $$(git branch --show-current)"
	@echo "Status:"
	@git status -s

# =============================================================================
# Git Hooks & Version Management
# =============================================================================

# Install git hooks for version consistency checks
setup-hooks:
	@echo "๐Ÿ”ง Setting up git hooks..."
	@git config core.hooksPath .githooks
	@echo "โœ… Git hooks installed (.githooks/)"
	@echo "   pre-commit: checks version consistency in staged Cargo.toml files"
	@echo "   pre-push:   validates tag versions match Cargo.toml before pushing"

# Check version consistency across all workspace crates
check-versions:
	@./scripts/check-versions.sh