name: json-data-processing
mode: standard
commands:
- shell: "cat package.json 2>/dev/null || echo '{\"name\":\"test\",\"version\":\"1.0.0\"}'"
capture: "package_info"
capture_format: json
- shell: "echo 'Package: ${package_info.name} v${package_info.version}'"
capture: "package_summary"
- shell: |
echo '{
"branch": "'$(git branch --show-current 2>/dev/null || echo main)'",
"commit": "'$(git rev-parse --short HEAD 2>/dev/null || echo abc123)'",
"dirty": '$(git diff --quiet 2>/dev/null && echo false || echo true)'
}'
capture: "git_info"
capture_format: json
- shell: |
cat << EOF
Build Status Report
===================
Package: ${package_summary}
Git Branch: ${git_info.branch}
Git Commit: ${git_info.commit}
Has Changes: ${git_info.dirty}
EOF
capture: "status_report"
- shell: |
echo '{
"package": {
"name": "${package_info.name}",
"version": "${package_info.version}"
},
"git": {
"branch": "${git_info.branch}",
"commit": "${git_info.commit}",
"dirty": ${git_info.dirty}
},
"report": "${status_report}"
}'
capture: "final_summary"
capture_format: json
- shell: "echo 'Final summary saved with ${final_summary|length:100} characters'"