feat(scripts): add unified startup scripts for full stack development

Add comprehensive startup scripts for managing all ZCLAW services:

Windows (PowerShell):
- start.ps1 / start-all.ps1 - Unified service launcher
- Supports -NoBrowser, -NoGateway, -Dev, -Stop flags

Unix (Bash):
- start.sh - Cross-platform launcher for macOS/Linux

Makefile:
- make start / make start-unix
- make desktop / make desktop-build
- make setup / make test / make clean

pnpm commands:
- pnpm start - Start all services
- pnpm start:dev - Development mode with hot reload
- pnpm start:no-browser - Skip ChromeDriver
- pnpm start:no-gateway - Skip OpenFang gateway
- pnpm desktop - Start Tauri only
- pnpm chromedriver - Start ChromeDriver only

Services managed:
1. ChromeDriver (port 4444) - Browser automation
2. OpenFang Gateway (port 4200) - AI Agent runtime
3. Tauri Desktop - React + Rust frontend

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-03-17 09:23:44 +08:00
parent 6bd9b841aa
commit d890fa1858
6 changed files with 658 additions and 2 deletions

79
Makefile Normal file
View File

@@ -0,0 +1,79 @@
# ZCLAW Makefile
# Cross-platform task runner
.PHONY: help start start-dev start-no-browser start-no-gateway desktop desktop-build setup test clean
help: ## Show this help message
@echo "ZCLAW - OpenFang Desktop Client"
@echo ""
@echo "Usage: make [target]"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'
# === Startup Commands ===
start: ## Start all services (Windows: PowerShell)
@pwsh -File ./start.ps1
start-dev: ## Start all services in dev mode
@pwsh -File ./start.ps1 -Dev
start-no-browser: ## Start without ChromeDriver
@pwsh -File ./start.ps1 -NoBrowser
start-no-gateway: ## Start without OpenFang gateway
@pwsh -File ./start.ps1 -NoGateway
start-unix: ## Start all services (Unix: macOS/Linux)
@chmod +x ./start.sh && ./start.sh
start-unix-dev: ## Start all services in dev mode (Unix)
@chmod +x ./start.sh && ./start.sh --dev
# === Desktop App ===
desktop: ## Start Tauri desktop app in dev mode
@cd desktop && pnpm tauri dev
desktop-build: ## Build Tauri desktop app
@cd desktop && pnpm build && pnpm tauri build
# === Development ===
setup: ## Run first-time setup
@tsx scripts/setup.ts
test: ## Run all tests
@pnpm test
test-desktop: ## Run desktop tests
@cd desktop && pnpm test
typecheck: ## Run TypeScript type check
@cd desktop && pnpm typecheck
# === Services ===
gateway: ## Start OpenFang gateway
@openfang gateway start
gateway-status: ## Check gateway status
@openfang gateway status
chromedriver: ## Start ChromeDriver on port 4444
@chromedriver --port=4444
# === Cleanup ===
clean: ## Clean build artifacts
@rm -rf dist/
@rm -rf desktop/dist/
@rm -rf desktop/src-tauri/target/
@rm -rf node_modules/
@rm -rf desktop/node_modules/
@echo "Cleaned build artifacts"
clean-deep: clean ## Deep clean (including pnpm cache)
@rm -rf desktop/pnpm-lock.yaml
@rm -rf pnpm-lock.yaml
@echo "Deep clean complete. Run 'pnpm install' to reinstall."