-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
543 lines (468 loc) · 21.3 KB
/
Copy pathMakefile
File metadata and controls
543 lines (468 loc) · 21.3 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
.PHONY: setup build build-fast test proto clean help install-tools deps lint all
.PHONY: kernel-build kernel-dev kernel-test kernel-proto
.PHONY: modules-build modules-test
.PHONY: frontend-build frontend-dev frontend-install
.PHONY: docker-build docker-up docker-down docker-clean
.PHONY: deploy-setup deploy e2e-test
# ============================================================================
# INOS v1.9 - Root Makefile
# The Distributed Runtime Build System
# ============================================================================
# Variables
VERSION=$(shell git describe --tags --always --dirty 2>/dev/null || echo "v1.9-dev")
PROJECT_NAME=inos
DOCKER_IMAGE=$(PROJECT_NAME)
DOCKER_COMPOSE=docker compose -f deployment/docker/docker-compose.yml
# Include .env file if it exists
-include .env
export $(shell sed 's/=.*//' .env 2>/dev/null)
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
# WASM build parameters (CRITICAL: Multithreading support)
GOOS=js
GOARCH=wasm
# Enable SharedArrayBuffer and threading support
WASM_BUILD_FLAGS=-ldflags="-s -w" -tags="wasm,threads"
# For development (with debug symbols)
WASM_DEV_FLAGS=-tags="wasm,threads"
# Rust parameters
CARGO=cargo +nightly
RUST_TARGET=wasm32-unknown-unknown
# Enable shared memory with atomics - requires nightly + build-std
RUST_BUILD_FLAGS=--target $(RUST_TARGET) --release -Z build-std=std,panic_abort
RUSTFLAGS=-C target-feature=+atomics,+bulk-memory,+mutable-globals -C link-arg=--max-memory=1073741824 --cfg getrandom_backend=\"custom\"
# Cap'n Proto parameters (consumer-relative outputs)
CAPNP_PATH=protocols/schemas
CAPNP_GO_OUT=kernel/gen
CAPNP_RUST_OUT=modules/gen
# Optimization tools
WASM_OPT=wasm-opt
BROTLI=brotli
# Cap'n Proto TypeScript plugin (capnpc-ts)
CAPNPC_TS_BIN=$(firstword $(wildcard $(CURDIR)/node_modules/.bin/capnpc-ts) $(wildcard $(CURDIR)/frontend/node_modules/.bin/capnpc-ts) $(shell command -v capnpc-ts 2>/dev/null))
CAPNPC_TS_DIR=$(if $(CAPNPC_TS_BIN),$(dir $(CAPNPC_TS_BIN)))
HAVE_CAPNPC_TS=$(if $(CAPNPC_TS_BIN),1,0)
# Derived sources for incremental builds
PROTO_SOURCES=$(shell find $(CAPNP_PATH) -name '*.capnp')
KERNEL_SOURCES=$(shell find kernel -name '*.go')
MODULES_SOURCES=$(shell find modules -name '*.rs')
FRONTEND_SOURCES=$(shell find frontend -type f -not -path 'frontend/dist/*' -not -path 'frontend/node_modules/*')
FRONTEND_LOCKFILES=$(wildcard frontend/package-lock.json frontend/pnpm-lock.yaml frontend/yarn.lock)
# Build outputs / stamps
KERNEL_WASM=frontend/public/kernel.wasm
KERNEL_WASM_BR=frontend/public/kernel.wasm.br
MODULES_STAMP=frontend/public/modules/.stamp
FRONTEND_STAMP=frontend/dist/.stamp
CAPNP_GO_STAMP=$(CAPNP_GO_OUT)/.stamp
CAPNP_TS_STAMP=frontend/bridge/generated/.stamp
HAVE_BROTLI=$(shell command -v $(BROTLI) >/dev/null 2>&1 && echo 1)
JOBS?=$(shell (getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4))
# Default target
.DEFAULT_GOAL := help
# ============================================================================
# Setup & Dependencies
# ============================================================================
setup: install-tools
@echo "🚀 Setting up INOS development environment..."
@$(MAKE) deps
@$(MAKE) proto
@echo "✅ Setup complete"
install-tools:
@echo "📦 Installing required tools..."
@echo "Installing Go tools..."
@$(GOGET) zombiezen.com/go/capnproto2/...@latest || true
@$(GOGET) github.com/google/uuid@latest || true
@$(GOGET) golang.org/x/sync/errgroup@latest || true
@echo ""
@echo "⚠️ System dependencies required:"
@echo " 1. Cap'n Proto compiler:"
@echo " macOS: brew install capnp"
@echo " Ubuntu: apt-get install capnproto"
@echo ""
@echo " 2. WASM optimization tools (optional but recommended):"
@echo " macOS: brew install binaryen brotli"
@echo " Ubuntu: apt-get install binaryen brotli"
@echo ""
@echo " 3. Rust toolchain with WASM target:"
@echo " curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh"
@echo " rustup target add wasm32-unknown-unknown"
@echo ""
@echo "✅ Go tools installed"
deps:
@echo "📚 Installing dependencies..."
@cd kernel && $(GOMOD) download && $(GOMOD) tidy
@cd modules && $(CARGO) fetch
@echo "✅ Dependencies installed"
# ============================================================================
# Protocol Generation (Cap'n Proto)
# ============================================================================
proto: $(CAPNP_GO_STAMP) proto-rust $(CAPNP_TS_STAMP)
@echo "✅ All protocol code generated"
proto-go: $(CAPNP_GO_STAMP)
proto-rust:
@echo "🔧 Generating Rust code from Cap'n Proto schemas..."
@mkdir -p $(CAPNP_RUST_OUT)
@echo "⚠️ Note: Rust Cap'n Proto code generation is handled by build.rs"
@echo " Location: modules/build.rs"
@echo " Generated code will be in: modules/target/<profile>/build/*/out/"
@echo " Rust modules import generated code automatically"
@echo "✅ Rust protocol generation configured"
proto-ts: $(CAPNP_TS_STAMP)
@echo "✅ TypeScript protocol code + constants generated in frontend/bridge/generated"
$(CAPNP_GO_STAMP): $(PROTO_SOURCES) scripts/gen-proto-go.sh
@mkdir -p $(CAPNP_GO_OUT)
@./scripts/gen-proto-go.sh $(CAPNP_GO_OUT)
@touch $@
$(CAPNP_TS_STAMP): $(PROTO_SOURCES) scripts/gen-capnp-consts-ts.js scripts/fix-capnp-imports.js
@echo "🔧 Generating TypeScript code from Cap'n Proto schemas..."
@mkdir -p frontend/bridge/generated
@if [ "$(HAVE_CAPNPC_TS)" != "1" ]; then \
echo "⚠️ capnpc-ts not found. Skipping TS schema generation (consts will still be generated)."; \
echo " Looked for: $(CURDIR)/node_modules/.bin/capnpc-ts and $(CURDIR)/frontend/node_modules/.bin/capnpc-ts"; \
fi
@for schema_file in $(PROTO_SOURCES); do \
echo "Processing $$schema_file..."; \
if [ "$(HAVE_CAPNPC_TS)" = "1" ]; then \
PATH="$(CAPNPC_TS_DIR):$$PATH" capnp compile -I$(CAPNP_PATH) -o ts:frontend/bridge/generated $$schema_file || true; \
fi; \
node scripts/gen-capnp-consts-ts.js $$schema_file || true; \
done
@node scripts/fix-capnp-imports.js
@touch $@
gen-context:
@echo "📋 Generating Codebase Context Registry..."
@go run scripts/gen_context.go > inos_context.json
@echo "✅ Context generated: inos_context.json"
# ============================================================================
# Kernel Build (Go WASM - Layer 2)
# ============================================================================
kernel-build: $(KERNEL_WASM) $(if $(HAVE_BROTLI),$(KERNEL_WASM_BR))
@echo "✅ Kernel build complete: $(KERNEL_WASM)"
$(KERNEL_WASM): $(KERNEL_SOURCES) kernel/go.mod kernel/go.sum $(CAPNP_GO_STAMP)
@echo "🧠 Building INOS Kernel (Go WASM with multithreading)..."
@mkdir -p frontend/public
@cd kernel && GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) $(WASM_BUILD_FLAGS) -o ../frontend/public/kernel.wasm .
@# Copy wasm_exec.js (required for Go WASM)
@GOROOT=$$(go env GOROOT) && \
WASM_EXEC_PATH_NEW="$$GOROOT/lib/wasm/wasm_exec.js" && \
WASM_EXEC_PATH_OLD="$$GOROOT/misc/wasm/wasm_exec.js" && \
if [ -f "$$WASM_EXEC_PATH_NEW" ]; then cp "$$WASM_EXEC_PATH_NEW" frontend/public/; \
elif [ -f "$$WASM_EXEC_PATH_OLD" ]; then cp "$$WASM_EXEC_PATH_OLD" frontend/public/; \
else echo "❌ Error: wasm_exec.js not found in GOROOT ($$GOROOT)." >&2; exit 1; fi
@if command -v $(WASM_OPT) > /dev/null 2>&1; then \
echo "⚡ Optimizing kernel.wasm with wasm-opt..."; \
$(WASM_OPT) -Oz --enable-threads --enable-bulk-memory --enable-nontrapping-float-to-int --enable-sign-ext --strip-debug \
-o frontend/public/kernel.wasm frontend/public/kernel.wasm; \
echo "✅ WASM optimized"; \
else \
echo "⚠️ wasm-opt not installed. Skipping optimization."; \
fi
@# Patch AFTER optimization
@# NOTE: Disabled - Go WASM doesn't support SharedArrayBuffer natively
@# Binary patching breaks the WASM structure
@echo "ℹ️ Kernel will use JS-created SharedArrayBuffer (provided during instantiation)"
@# @echo "🔧 Patching kernel for SharedArrayBuffer (post-optimization)..."
@# @node scripts/patch_wasm_memory.js frontend/public/kernel.wasm
@echo "✅ Kernel build complete: frontend/public/kernel.wasm"
ifeq ($(HAVE_BROTLI),1)
$(KERNEL_WASM_BR): $(KERNEL_WASM)
@echo "📦 Compressing kernel.wasm with brotli..."
@$(BROTLI) -q 11 -f $(KERNEL_WASM) -o $(KERNEL_WASM_BR)
@echo "✅ WASM compressed ($$(ls -lh $(KERNEL_WASM_BR) | awk '{print $$5}'))"
endif
kernel-dev: $(CAPNP_GO_STAMP)
@echo "🧠 Building INOS Kernel (Development mode - with debug symbols)..."
@mkdir -p frontend/public
@cd kernel && GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) $(WASM_DEV_FLAGS) -o ../frontend/public/kernel.wasm .
@GOROOT=$$(go env GOROOT) && \
WASM_EXEC_PATH_NEW="$$GOROOT/lib/wasm/wasm_exec.js" && \
WASM_EXEC_PATH_OLD="$$GOROOT/misc/wasm/wasm_exec.js" && \
if [ -f "$$WASM_EXEC_PATH_NEW" ]; then cp "$$WASM_EXEC_PATH_NEW" frontend/public/; \
elif [ -f "$$WASM_EXEC_PATH_OLD" ]; then cp "$$WASM_EXEC_PATH_OLD" frontend/public/; \
else echo "❌ Error: wasm_exec.js not found." >&2; exit 1; fi
@echo "✅ Kernel build complete (Development): frontend/public/kernel.wasm"
kernel-test:
@echo "🧪 Running Kernel tests (native Go)..."
@cd kernel && $(GOTEST) -v -race ./...
@echo "✅ Kernel tests complete"
kernel-proto: proto-go
@echo "✅ Kernel protocols generated"
# ============================================================================
# Modules Build (Rust WASM - Layer 3)
# ============================================================================
modules-build: $(MODULES_STAMP)
@echo "✅ Modules build complete"
$(MODULES_STAMP): $(MODULES_SOURCES) modules/Cargo.toml modules/Cargo.lock $(PROTO_SOURCES)
@echo "💪 Building INOS Modules (Rust WASM)..."
@cd modules && RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build $(RUST_BUILD_FLAGS)
@echo "📦 Copying WASM modules to frontend..."
@mkdir -p frontend/public/modules
@for module in compute vault drivers diagnostics; do \
if [ -f "modules/target/$(RUST_TARGET)/release/$$module.wasm" ]; then \
cp "modules/target/$(RUST_TARGET)/release/$$module.wasm" "frontend/public/modules/$$module.wasm"; \
echo " ✅ Copied $$module.wasm"; \
fi \
done
@echo "🔍 Verifying architectural symbols..."
@node scripts/verify_symbols.js
@# Optimize each module
@if command -v $(WASM_OPT) > /dev/null 2>&1; then \
echo "⚡ Optimizing Rust modules..."; \
for wasm_file in frontend/public/modules/*.wasm; do \
if [ -f "$$wasm_file" ]; then \
echo "Optimizing $$wasm_file..."; \
$(WASM_OPT) -Oz --enable-threads --enable-bulk-memory --enable-simd --enable-nontrapping-float-to-int --enable-sign-ext --strip-debug \
-o "$$wasm_file" "$$wasm_file"; \
fi \
done; \
echo "✅ Modules optimized"; \
fi
@# Patch module imports AFTER optimization
@# TEMPORARILY DISABLED FOR DEBUGGING
@echo "⚠️ Skipping module patches (debugging)"
@# @echo "🔧 Patching module imports for SharedArrayBuffer (post-optimization)..."
@# @for wasm_file in frontend/public/modules/*.wasm; do \
@# if [ -f "$$wasm_file" ]; then \
@# node scripts/patch_wasm_import.js "$$wasm_file"; \
@# fi \
@# done
@# Compress modules
@if command -v $(BROTLI) > /dev/null 2>&1; then \
echo "📦 Compressing modules..."; \
for wasm_file in frontend/public/modules/*.wasm; do \
if [ -f "$$wasm_file" ]; then \
$(BROTLI) -q 11 -f "$$wasm_file" -o "$$wasm_file.br"; \
fi \
done; \
echo "✅ Modules compressed"; \
fi
@touch $@
modules-test:
@echo "🧪 Running Modules tests..."
@cd modules && $(CARGO) test
@echo "✅ Modules tests complete"
# Usage: make check-module MODULE=ml
check-module:
@if [ -z "$(MODULE)" ]; then echo "❌ Error: MODULE argument required. Usage: make check-module MODULE=<name>"; exit 1; fi
@echo "🔍 Checking module: $(MODULE)..."
@cd modules && $(CARGO) check -p $(MODULE)
@echo "✅ Module $(MODULE) checked"
# Usage: make test-module MODULE=ml
test-module:
@if [ -z "$(MODULE)" ]; then echo "❌ Error: MODULE argument required. Usage: make test-module MODULE=<name>"; exit 1; fi
@echo "🧪 Testing module: $(MODULE)..."
@cd modules && $(CARGO) test -p $(MODULE)
@echo "✅ Module $(MODULE) tested"
# ============================================================================
# Frontend Build (React + Vite - Layer 1)
# ============================================================================
frontend-install:
@echo "📦 Installing frontend dependencies..."
@cd frontend && npm install
@echo "✅ Frontend dependencies installed"
frontend-dev: kernel-dev
@echo "🎨 Starting frontend dev server..."
@echo "⚠️ Note: Vite must be configured with COOP/COEP headers for SharedArrayBuffer"
@node integration/signaling/server.js & cd frontend && npm run dev
frontend-build: $(FRONTEND_STAMP)
@echo "✅ Frontend build complete"
$(FRONTEND_STAMP): $(FRONTEND_SOURCES) $(KERNEL_WASM) $(MODULES_STAMP) $(CAPNP_TS_STAMP) frontend/package.json $(FRONTEND_LOCKFILES)
@echo "🎨 Building frontend for production..."
@echo "📦 Ensuring WASM artifacts are in place..."
@mkdir -p frontend/public/modules
@ls -lh $(KERNEL_WASM)
@ls -lh frontend/public/modules/*.wasm
@cd frontend && npm run build
@touch $@
# ============================================================================
# Build All
# ============================================================================
all: proto kernel-build modules-build frontend-build
@echo "✅ All components built successfully"
@echo ""
@echo "📊 Build Summary:"
@echo " Kernel: frontend/public/kernel.wasm"
@echo " Modules: frontend/public/modules/*.wasm"
@echo " Frontend: frontend/dist/"
build: all
build-fast:
@$(MAKE) -j$(JOBS) all
# ============================================================================
# Testing
# ============================================================================
# ============================================================================
test: kernel-test modules-test e2e-test
@echo "✅ All tests complete"
e2e-test:
@echo "🧪 Running E2E tests in integration directory..."
@cd integration && npm test
# Comprehensive testing with coverage
test-coverage:
@echo "📊 Running tests with coverage analysis..."
@mkdir -p coverage
@cd kernel && $(GOTEST) -v -race -coverprofile=../coverage/kernel.out -covermode=atomic ./...
@cd kernel && go tool cover -html=../coverage/kernel.out -o ../coverage/kernel.html
@cd kernel && go tool cover -func=../coverage/kernel.out | grep total | awk '{print "Kernel Coverage: " $$3}'
@echo "📈 Coverage report generated: coverage/kernel.html"
@echo ""
@echo "📊 Package-level coverage:"
@cd kernel && go tool cover -func=../coverage/kernel.out | grep -E "core/mesh/(routing|optimization|internal|common|transport)" | awk '{printf " %-50s %s\n", $$1, $$3}'
@echo ""
@echo "🎯 Coverage threshold check (90%):"
@cd kernel && go tool cover -func=../coverage/kernel.out | grep total | awk '{if ($$3+0 < 90.0) {print "❌ FAILED: Coverage " $$3 " is below 90%"; exit 1} else {print "✅ PASSED: Coverage " $$3 " meets 90% threshold"}}'
# Run benchmarks
test-bench:
@echo "⚡ Running performance benchmarks..."
@cd kernel && $(GOTEST) -bench=. -benchmem -benchtime=3s ./core/mesh/... | tee ../coverage/bench.txt
@echo "✅ Benchmark results saved to coverage/bench.txt"
# Run tests with race detector
test-race:
@echo "🔍 Running tests with race detector..."
@cd kernel && $(GOTEST) -v -race ./...
@echo "✅ Race detector tests complete"
# Run tests for specific package
# Usage: make test-package PKG=core/mesh/routing
test-package:
@if [ -z "$(PKG)" ]; then echo "❌ Error: PKG argument required. Usage: make test-package PKG=core/mesh/routing"; exit 1; fi
@echo "🧪 Testing package: $(PKG)..."
@cd kernel && $(GOTEST) -v -race -coverprofile=../coverage/$(subst /,_,$(PKG)).out ./$(PKG)
@cd kernel && go tool cover -html=../coverage/$(subst /,_,$(PKG)).out -o ../coverage/$(subst /,_,$(PKG)).html
@cd kernel && go tool cover -func=../coverage/$(subst /,_,$(PKG)).out | grep total
@echo "✅ Package $(PKG) tested"
# Run quick tests (no race detector, no coverage)
test-quick:
@echo "⚡ Running quick tests..."
@cd kernel && $(GOTEST) -short ./...
@echo "✅ Quick tests complete"
# Continuous testing (watch mode)
test-watch:
@echo "👀 Watching for changes..."
@echo "⚠️ Install: go install github.com/cespare/reflex@latest"
@reflex -r '\.go$$' -s -- sh -c 'clear && make test-quick'
# ============================================================================
# Linting
# ============================================================================
lint:
@echo "🔍 Running linters..."
@echo "Linting Go code..."
@cd kernel && go vet ./...
@cd kernel && gofmt -l . | grep . && echo "❌ Go files need formatting" && exit 1 || echo "✅ Go code formatted"
@echo "Linting Rust code..."
@cd modules && $(CARGO) clippy -- -D warnings
@echo "✅ Linting complete"
# ============================================================================
# Docker
# ============================================================================
docker-build:
@echo "🐳 Building Docker images..."
@$(DOCKER_COMPOSE) build
@echo "✅ Docker build complete"
docker-up:
@echo "🚀 Starting Docker containers..."
@$(DOCKER_COMPOSE) up -d
@echo "✅ Docker containers started"
docker-down:
@echo "🛑 Stopping Docker containers..."
@$(DOCKER_COMPOSE) down
@echo "✅ Docker containers stopped"
docker-logs:
@$(DOCKER_COMPOSE) logs -f
docker-clean:
@echo "🧹 Cleaning Docker resources..."
@docker builder prune -a -f
@docker image prune -a -f
@docker container prune -f
@docker volume prune -f
@echo "✅ Docker cleanup complete"
# ============================================================================
# Deployment
# ============================================================================
deploy-setup:
@echo "🚀 Setting up deployment environment..."
@echo "⚠️ Configure deployment in deployment/ directory"
deploy:
@echo "🚀 Deploying INOS..."
@echo "⚠️ Deployment strategy to be implemented"
# ============================================================================
# Clean
# ============================================================================
clean:
@echo "🧹 Cleaning build artifacts..."
@rm -rf frontend/public/kernel.wasm
@rm -rf frontend/public/kernel.wasm.br
@rm -rf frontend/public/wasm_exec.js
@rm -rf frontend/public/modules/
@rm -rf frontend/dist/
@rm -rf $(CAPNP_GO_STAMP) $(CAPNP_TS_STAMP) $(MODULES_STAMP) $(FRONTEND_STAMP)
@cd kernel && $(GOCLEAN)
@cd modules && $(CARGO) clean
@find $(CAPNP_GO_OUT) -type f -delete 2>/dev/null || true
@echo "✅ Clean complete"
# ============================================================================
# Help
# ============================================================================
help:
@echo "INOS v1.9 - The Distributed Runtime Build System"
@echo "=================================================="
@echo ""
@echo "Setup & Dependencies:"
@echo " setup - Set up development environment (install tools + deps + proto)"
@echo " install-tools - Install required build tools"
@echo " deps - Install Go and Rust dependencies"
@echo ""
@echo "Protocol Generation:"
@echo " proto - Generate all protocol code (Go + Rust + TypeScript)"
@echo " proto-go - Generate Go code from Cap'n Proto schemas"
@echo " proto-rust - Configure Rust Cap'n Proto generation"
@echo " proto-ts - Generate TypeScript code from Cap'n Proto schemas"
@echo ""
@echo "Kernel (Layer 2 - Go WASM):"
@echo " kernel-build - Build kernel with optimization + compression"
@echo " kernel-dev - Build kernel in development mode (with debug symbols)"
@echo " kernel-test - Run kernel tests"
@echo ""
@echo "Modules (Layer 3 - Rust WASM):"
@echo " modules-build - Build all Rust modules with optimization"
@echo " modules-test - Run module tests"
@echo ""
@echo "Frontend (Layer 1 - React + Vite):"
@echo " frontend-install - Install frontend dependencies"
@echo " frontend-dev - Start frontend dev server"
@echo " frontend-build - Build frontend for production"
@echo ""
@echo "Build All:"
@echo " all / build - Build all components (kernel + modules + frontend)"
@echo " build-fast - Parallel build (uses detected CPU cores)"
@echo ""
@echo "Testing & Quality:"
@echo " test - Run all tests (kernel + modules)"
@echo " lint - Run all linters"
@echo ""
@echo "Docker:"
@echo " docker-build - Build Docker images"
@echo " docker-up - Start Docker containers"
@echo " docker-down - Stop Docker containers"
@echo " docker-logs - Show Docker logs"
@echo " docker-clean - Clean Docker resources"
@echo ""
@echo "Utilities:"
@echo " clean - Clean all build artifacts"
@echo " help - Show this help message"
@echo ""
@echo "Architecture:"
@echo " Layer 1 (Host): Nginx + JS Bridge (frontend/)"
@echo " Layer 2 (Kernel): Go WASM Orchestrator (kernel/)"
@echo " Layer 3 (Modules): Rust WASM Compute (modules/)"
@echo ""
@echo "Key Features:"
@echo " ✅ Multithreading support (SharedArrayBuffer + Web Workers)"
@echo " ✅ Cap'n Proto zero-copy serialization"
@echo " ✅ WASM optimization (wasm-opt + brotli compression)"
@echo " ✅ Hierarchical threading model"
@echo ""
@echo "Version: $(VERSION)"