Files
bzzz/Makefile
anthonyrawlins 03d938037a Complete BZZZ deployment system fixes with all remaining changes
## Additional Changes:
- Add test configurations and deployment artifacts
- Update web assets and build manifests
- Add version management scripts
- Include local test configs (.bzzz/ directory)
- Update internal runtime and agent configurations
- Refresh Next.js build artifacts

## Final State:
- Complete deployment system working end-to-end
- ironwood successfully deployed and operational
- All hardcoded values removed from codebase
- Config generation and validation fully functional

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 22:06:01 +10:00

162 lines
5.3 KiB
Makefile

# BZZZ Build System with Embedded Web UI - Dual Binary Support
.PHONY: build build-agent build-hap build-ui build-go clean dev setup install deps test
# Configuration
UI_DIR = install/config-ui
BUILD_DIR = build
DIST_DIR = $(UI_DIR)/dist
EMBED_DIR = pkg/web
# Default target - build both binaries
all: build
# Install dependencies
deps:
@echo "📦 Installing Go dependencies..."
go mod download
go mod tidy
@echo "📦 Installing Node.js dependencies..."
cd $(UI_DIR) && npm install
# Development mode - run both Go and React in development
dev:
@echo "🚀 Starting development mode..."
@echo " Go API: http://localhost:8080"
@echo " React UI: http://localhost:3000"
cd $(UI_DIR) && npm run dev &
go run main.go
# Auto-bump version
bump-version:
@echo "🔖 Auto-bumping version..."
@./scripts/bump-version.sh
# Build the complete application - both binaries
build: bump-version build-ui embed-ui build-agent build-hap
# Build the React web UI
build-ui:
@echo "🔨 Building React web UI..."
@mkdir -p $(BUILD_DIR)
cd $(UI_DIR) && npm ci
cd $(UI_DIR) && npm run build
@echo "✅ Web UI built successfully"
# Embed the web UI into Go source
embed-ui: build-ui
@echo "📦 Embedding web UI into Go binary..."
@mkdir -p $(EMBED_DIR)
@if [ -d "$(UI_DIR)/out" ]; then \
echo "📁 Copying from Next.js out/ directory..."; \
mkdir -p $(EMBED_DIR)/static && cp -r $(UI_DIR)/out/* $(EMBED_DIR)/static/; \
elif [ -d "$(UI_DIR)/.next/static" ]; then \
echo "📁 Copying from .next/static directory..."; \
mkdir -p $(EMBED_DIR)/static && cp -r $(UI_DIR)/.next/static $(EMBED_DIR)/static/; \
else \
echo "❌ ERROR: No build output found in $(UI_DIR)/out or $(UI_DIR)/.next/static"; \
exit 1; \
fi
@echo "✅ Web UI embedded successfully"
# Build the autonomous agent binary
build-agent: build-ui embed-ui
@echo "🔨 Building BZZZ Agent binary with embedded web UI..."
@mkdir -p $(BUILD_DIR)
CGO_ENABLED=0 go build -ldflags="-s -w" -o $(BUILD_DIR)/bzzz-agent ./cmd/agent
@echo "✅ BZZZ Agent binary built successfully: $(BUILD_DIR)/bzzz-agent"
# Build the HAP binary
build-hap: build-ui embed-ui
@echo "🔨 Building BZZZ HAP binary with embedded web UI..."
@mkdir -p $(BUILD_DIR)
CGO_ENABLED=0 go build -ldflags="-s -w" -o $(BUILD_DIR)/bzzz-hap ./cmd/hap
@echo "✅ BZZZ HAP binary built successfully: $(BUILD_DIR)/bzzz-hap"
# Legacy build target for backward compatibility
build-go: build-agent
@echo "⚠️ build-go is deprecated, use build-agent or build-hap"
# Setup development environment
setup: deps
@echo "🔧 Setting up development environment..."
@mkdir -p $(BUILD_DIR)
@mkdir -p $(EMBED_DIR)
@echo "✅ Development environment ready"
# Install BZZZ binaries system-wide
install: build
@echo "📥 Installing BZZZ binaries..."
sudo cp $(BUILD_DIR)/bzzz-agent /usr/local/bin/
sudo cp $(BUILD_DIR)/bzzz-hap /usr/local/bin/
sudo chmod +x /usr/local/bin/bzzz-agent
sudo chmod +x /usr/local/bin/bzzz-hap
@echo "✅ BZZZ Agent installed to /usr/local/bin/bzzz-agent"
@echo "✅ BZZZ HAP installed to /usr/local/bin/bzzz-hap"
# Run tests
test:
@echo "🧪 Running tests..."
go test -v ./...
# Clean build artifacts
clean:
@echo "🧹 Cleaning build artifacts..."
rm -rf $(BUILD_DIR)
@if [ -d "$(EMBED_DIR)" ]; then \
find $(EMBED_DIR) -mindepth 1 -name "*.go" -prune -o -type f -exec rm {} + && \
find $(EMBED_DIR) -mindepth 1 -type d -empty -delete; \
fi
rm -rf $(UI_DIR)/node_modules
rm -rf $(UI_DIR)/.next
rm -rf $(UI_DIR)/out
rm -rf $(UI_DIR)/dist
@echo "✅ Clean complete"
# Quick build for development (skip UI rebuild if not changed)
quick-build-agent:
@echo "⚡ Quick agent build (Go only)..."
@mkdir -p $(BUILD_DIR)
go build -o $(BUILD_DIR)/bzzz-agent ./cmd/agent
@echo "✅ Quick agent build complete"
quick-build-hap:
@echo "⚡ Quick HAP build (Go only)..."
@mkdir -p $(BUILD_DIR)
go build -o $(BUILD_DIR)/bzzz-hap ./cmd/hap
@echo "✅ Quick HAP build complete"
# Quick build both binaries
quick-build: quick-build-agent quick-build-hap
# Docker build
docker-build:
@echo "🐳 Building Docker image..."
docker build -t bzzz:latest .
@echo "✅ Docker image built"
# Help
help:
@echo "BZZZ Dual-Binary Build System"
@echo ""
@echo "Available targets:"
@echo " all - Build both binaries with embedded UI (default)"
@echo " build - Build both binaries with embedded UI"
@echo " build-agent - Build autonomous agent binary only"
@echo " build-hap - Build human agent portal binary only"
@echo " build-ui - Build React web UI only"
@echo " embed-ui - Embed web UI into Go source"
@echo " dev - Start development mode"
@echo " setup - Setup development environment"
@echo " deps - Install dependencies"
@echo " install - Install both binaries system-wide"
@echo " test - Run tests"
@echo " clean - Clean build artifacts"
@echo " quick-build - Quick build both binaries (Go only)"
@echo " quick-build-agent- Quick build agent binary only"
@echo " quick-build-hap - Quick build HAP binary only"
@echo " docker-build - Build Docker image"
@echo " help - Show this help"
@echo ""
@echo "Binaries:"
@echo " bzzz-agent - Autonomous AI agent for task execution"
@echo " bzzz-hap - Human Agent Portal for interactive coordination"