Ensure the STAN workspace exists and manage output/diff.
Behavior:
stanPath/output
stanPath/diff
stanPath/patch
keep === false
output/archive.tar
diff/archive.prev.tar
output
Repo root.
Workspace folder (e.g., .stan).
.stan
When true, do not clear the output directory.
true
Absolute path to the workspace root (stanPath).
stanPath
Ensure the STAN workspace exists and manage output/diff.
Behavior:
stanPath/outputandstanPath/diffexist.stanPath/patchexists so archives can include it.keep === false, copyoutput/archive.tartodiff/archive.prev.tarif present, then clear only theoutputdirectory.