Bakebook class provides a .ctx property for accessing CLI context. Tasks use it to run real commands:
run options
run returns a subprocess.CompletedProcess, so with capture_output=True you can read what the command printed:
subprocess.Popen keyword arguments also pass through.
run_script
run_script(title=..., script=...) runs a multi-line script. It pretty-prints the script under a title first, so the terminal shows what the block does before it runs:
run (everything except shell, echo_cmd, and timeout).
Dry-run
Withbake -n, commands print instead of executing. ctx.run respects this automatically (see bake CLI).
Read the flag with self.ctx.dry_run, or flip it for a block. override_dry_run(True) previews commands inside a real run, and override_dry_run(False) forces a command to execute even under bake -n: