name: mapreduce-env-example
mode: mapreduce
env:
PROJECT_NAME: "example-project"
PROJECT_CONFIG: "config.yml"
FEATURES_PATH: "features"
OUTPUT_DIR: "output"
REPORT_FORMAT: "json"
MAX_RETRIES: "3"
TIMEOUT_SECONDS: "300"
DEBUG_MODE: "false"
API_TOKEN:
secret: true
value: "${GITHUB_TOKEN}"
profiles:
development:
description: "Development environment with debug enabled"
DEBUG_MODE: "true"
TIMEOUT_SECONDS: "60"
OUTPUT_DIR: "dev-output"
production:
description: "Production environment"
DEBUG_MODE: "false"
TIMEOUT_SECONDS: "300"
OUTPUT_DIR: "prod-output"
setup:
- shell: "echo Starting $PROJECT_NAME workflow"
- shell: "echo Debug mode: $DEBUG_MODE"
- shell: "mkdir -p $OUTPUT_DIR"
- shell: "echo Created output directory: ${OUTPUT_DIR}"
- shell: "echo '{\"items\": [{\"name\": \"item1\", \"path\": \"file1.txt\"}, {\"name\": \"item2\", \"path\": \"file2.txt\"}]}' > items.json"
map:
input: "items.json"
json_path: "$.items[*]"
agent_template:
- claude: "/process-item '${item.name}' --project $PROJECT_NAME --config $PROJECT_CONFIG"
- shell: "echo Processing ${item.name} for project $PROJECT_NAME"
- shell: "echo Output will be saved to $OUTPUT_DIR"
- shell: "timeout ${TIMEOUT_SECONDS}s ./process.sh ${item.path}"
on_failure:
- claude: "/fix-issue '${item.name}' --max-retries $MAX_RETRIES"
max_parallel: 5
reduce:
- shell: "echo Aggregating results for $PROJECT_NAME"
- claude: "/summarize ${map.results} --project $PROJECT_NAME --format $REPORT_FORMAT"
- shell: "cp summary.$REPORT_FORMAT $OUTPUT_DIR/${PROJECT_NAME}-summary.$REPORT_FORMAT"
- shell: "echo Processed ${map.successful}/${map.total} items"
- shell: "echo Results saved to ${OUTPUT_DIR}/${PROJECT_NAME}-summary.${REPORT_FORMAT}"
merge:
commands:
- shell: "echo Merging changes for $PROJECT_NAME"
- shell: "echo Debug mode was: $DEBUG_MODE"
- claude: "/validate-merge --branch ${merge.source_branch} --project $PROJECT_NAME"
- shell: "echo Merge completed for ${PROJECT_NAME}"