Could fmriprep output python scripts for individual steps?

When trying to debug and tweak certain steps in fmriprep, I’ve found it very helpful when there are “command.txt” files in the work dir that show me exactly what was run for that step. Its much more difficult (for me, but I suspect others too) to isolate actual operations, inputs, and outputs within the python workflow environment. Given how the pipelines are implemented, might it be straightforward to create an equivalent command.py or something for steps that are completed within python?

In case others encounter this who, like me, aren’t familiar with the inner working of nipype, I did find a way to do something close to what I wanted. In python, you can load the _node.pklz file in each workflow directory, which recreates the individual node, and you can run it in isolation:

from nipype.utils.filemanip import loadpkl
node=loadpkl("/work/fmriprep_23_2_wf/sub_01_wf/bold_ses_01_task_rest_wf/bold_MNI6_wf/resample/_node.pklz")

node.overwrite=True #if you want to overwrite the outputs
node._output_dir=None # use base_dir and node.name to create new directory (if needed below)
node.name="resample_new" # if you want a new workflow dir for this specific node
node.base_dir="/work_NEW" # if you want to write to an entirely new working path

#can mess with node.inputs

res=node.run()

# outputs will appear in /work_NEW/fmriprep_23_2_wf/sub_01_wf/bold_ses_01_task_rest_wf/bold_MNI6_wf/resample_new