Capstone Automation Project
Dry Run
Choose Safe Commands
Automation should separate planning from applying changes. A dry-run branch shows the command that would run without allowing real changes.
Program
Play the script to switch between dry-run and apply mode.
dry_run_release_command.sh
Replay: real traced execution (multi-file project)
#!/usr/bin/env bash
mode="dry-run"
target="staging"
if [[ "$mode" == "dry-run" ]]; then
command="printf preview:$target"
effect="no-change"
else
command="deploy --target $target"
effect="changes-allowed"
fi
echo "$mode $effect $command"
#!/usr/bin/env bash
mode="apply"
target="staging"
if [[ "$mode" == "dry-run" ]]; then
command="printf preview:$target"
effect="no-change"
else
command="deploy --target $target"
effect="changes-allowed"
fi
echo "$mode $effect $command"
mode ← dry-run
3mode="dry-run"4target="staging"values this stepdry-runmodetarget ← staging
3mode="dry-run"4target="staging"5if [[ "$mode" == "dry-run" ]]; thenvalues this stepstagingtargetif [[ "$mode" == "dry-run" ]]; then
4target="staging"5if [[ "$mode" == "dry-run" ]]; then6 command="printf preview:$target"values this stepdry-runmodecommand ← printf preview:staging
5if [[ "$mode" == "dry-run" ]]; then6 command="printf preview:$target"7 effect="no-change"values this stepprintf preview:stagingcommandstagingtargeteffect ← no-change
6 command="printf preview:$target"7 effect="no-change"8elsevalues this stepno-changeeffectecho "$mode $effect $command"
11fi12echo "$mode $effect $command"outputdry-run no-change printf preview:stagingvalues this stepdry-runmodeno-changeeffectprintf preview:stagingcommand
mode ← apply
3mode="apply"4target="staging"values this stepapplymodetarget ← staging
3mode="apply"4target="staging"5if [[ "$mode" == "dry-run" ]]; thenvalues this stepstagingtargetif [[ "$mode" == "dry-run" ]]; then
4target="staging"5if [[ "$mode" == "dry-run" ]]; then6 command="printf preview:$target"values this stepapplymodecommand ← deploy --target staging
8else9 command="deploy --target $target"10 effect="changes-allowed"values this stepdeploy --target stagingcommandstagingtargeteffect ← changes-allowed
9 command="deploy --target $target"10 effect="changes-allowed"11fivalues this stepchanges-allowedeffectecho "$mode $effect $command"
11fi12echo "$mode $effect $command"outputapply changes-allowed deploy --target stagingvalues this stepapplymodechanges-allowedeffectdeploy --target stagingcommand
dry run
A dry run reports intent without applying changes.
apply mode
Apply mode is the branch that would permit changes.
command plan
Keeping the command as data makes the selected action inspectable.