v2/examples/README-batch-init.md
This directory contains comprehensive examples demonstrating the powerful batch initialization features of Claude-Flow.
Simple Batch Setup
claude-flow init --batch-init project1,project2,project3 --sparc
Template-Based Setup
claude-flow init --batch-init api-v1,api-v2 --template web-api --environments dev,staging
Configuration File Setup
claude-flow init --config examples/batch-config-enterprise.json
batch-config-simple.jsonBasic configuration for 3 projects with web-api template across dev and staging environments.
Usage:
claude-flow init --config examples/batch-config-simple.json
Creates:
api-service-dev/ and api-service-staging/web-frontend-dev/ and web-frontend-staging/admin-dashboard-dev/ and admin-dashboard-staging/batch-config-advanced.jsonAdvanced configuration with project-specific templates and customizations.
Usage:
claude-flow init --config examples/batch-config-advanced.json
Creates:
user-api/ (Web API with PostgreSQL)notification-service/ (Microservice with RabbitMQ)admin-portal/ (React app with Material-UI)cli-tools/ (CLI tool for Node/Deno)payment-gateway/ (High-security microservice)batch-config-enterprise.jsonEnterprise-scale configuration with 12 projects across all environments.
Usage:
claude-flow init --config examples/batch-config-enterprise.json --max-concurrent 8
Creates:
batch-init-demo.jsInteractive demonstration of all batch initialization features.
Usage:
deno run --allow-all examples/batch-init-demo.js
Shows:
../tests/batch-init.test.jsComprehensive test suite for batch initialization functionality.
Usage:
deno run --allow-all tests/batch-init.test.js
Tests:
# Quick setup for small team
claude-flow init --batch-init api,web,mobile --template web-api --sparc
Best for:
# Use configuration file for better organization
claude-flow init --config batch-config-advanced.json --parallel
Best for:
# Enterprise-scale with high concurrency
claude-flow init --config batch-config-enterprise.json --max-concurrent 8 --parallel
Best for:
# Sequential (slower but lower resource usage)
claude-flow init --batch-init project1,project2,project3,project4,project5 --no-parallel
# Parallel (faster with optimal concurrency)
claude-flow init --batch-init project1,project2,project3,project4,project5 --parallel --max-concurrent 3
# With performance monitoring
claude-flow init --config batch-config-advanced.json --verbose
# Estimate before running
claude-flow batch estimate batch-config-enterprise.json
# Multiple API services
claude-flow init --batch-init user-api,product-api,order-api --template web-api
# With different environments
claude-flow init --batch-init inventory-api --template web-api --environments dev,staging,prod
# Frontend applications
claude-flow init --batch-init customer-portal,admin-panel --template react-app
# With SPARC for TDD
claude-flow init --batch-init dashboard --template react-app --sparc
# Containerized services
claude-flow init --batch-init auth-service,payment-service,notification-service --template microservice
# Production-ready with monitoring
claude-flow init --batch-init core-services --template microservice --environments prod --sparc
# Command-line utilities
claude-flow init --batch-init deployment-tool,migration-tool --template cli-tool
# Cross-platform tools
claude-flow init --batch-init admin-cli --template cli-tool --environments dev
# Development environment with debugging
claude-flow init --batch-init myapp --environments dev --template web-api
Creates:
# Staging environment for testing
claude-flow init --batch-init myapp --environments staging --template microservice
Creates:
# Production environment with security
claude-flow init --batch-init myapp --environments prod --template microservice
Creates:
# Complete CI/CD pipeline
claude-flow init --batch-init payment-service --environments dev,staging,prod --template microservice
Creates:
payment-service-dev/ - Development versionpayment-service-staging/ - Testing versionpayment-service-prod/ - Production version# SPARC-enabled batch initialization
claude-flow init --batch-init project1,project2 --sparc --template web-api
Creates:
.claude/commands/ - Claude Code slash commands# Custom batch configuration
cat > my-batch.json << 'EOF'
{
"projects": ["my-api", "my-web"],
"baseOptions": {
"sparc": true,
"template": "web-api",
"environments": ["dev"],
"parallel": true,
"maxConcurrency": 2
}
}
EOF
claude-flow init --config my-batch.json
# Create interactive configuration
claude-flow batch create-config --interactive
# Validate configuration
claude-flow batch validate-config my-batch.json
# Estimate resources
claude-flow batch estimate my-batch.json
# List available templates
claude-flow batch list-templates
# List available environments
claude-flow batch list-environments
# Get help
claude-flow batch help
# Reduce concurrency
claude-flow init --batch-init projects --max-concurrent 2
# Use minimal template
claude-flow init --batch-init projects --minimal
# Enable parallel processing
claude-flow init --batch-init projects --parallel
# Use faster template
claude-flow init --batch-init projects --template cli-tool
# Validate first
claude-flow batch validate-config my-batch.json
# Use force if needed
claude-flow init --config my-batch.json --force
# Verbose output for debugging
claude-flow init --batch-init projects --verbose
# Sequential mode for easier debugging
claude-flow init --batch-init projects --no-parallel
# Test with a few projects first
claude-flow init --batch-init test1,test2 --template web-api
# Better for complex setups
claude-flow batch create-config enterprise-setup.json
# Edit the file, then:
claude-flow init --config enterprise-setup.json
# Always validate configurations
claude-flow batch validate-config my-batch.json
# Estimate resources
claude-flow batch estimate my-batch.json
# Use performance monitoring
claude-flow init --config my-batch.json --verbose
# Adjust concurrency based on system
claude-flow init --config my-batch.json --max-concurrent 4
# Use same template across environments
claude-flow init --batch-init myapp --environments dev,staging,prod --template microservice
# Configure resource limits in batch config
{
"baseOptions": {
"maxConcurrency": 3,
"performanceMonitoring": true,
"resourceLimits": {
"maxMemoryMB": 2048,
"maxCPUPercent": 80
}
}
}
# Use project-specific configurations
{
"projectConfigs": {
"high-performance-api": {
"template": "microservice",
"environment": "prod",
"customConfig": {
"optimization": "aggressive",
"caching": "redis",
"monitoring": "detailed"
}
}
}
}
# CI/CD pipeline integration
name: Batch Project Setup
on: workflow_dispatch
jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup projects
run: |
npx claude-flow@latest init --config .github/batch-config.json
claude-flow batch create-config --interactiveFor more information, see the Batch Initialization Documentation.