From 45bd49bedcdca210e12588011e95e2dd535cc10a Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sun, 15 Mar 2026 17:22:13 -0400 Subject: [PATCH] Use temp dir for dry-run instead of ~/.fabro/runs to avoid clutter in `fabro ps -a` Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/crates/fabro-workflows/src/cli/run.rs | 36 ++++++++++++++--------- test/docs/run_tests.sh | 4 ++- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/lib/crates/fabro-workflows/src/cli/run.rs b/lib/crates/fabro-workflows/src/cli/run.rs index a323e02a2..b60ea79da 100644 --- a/lib/crates/fabro-workflows/src/cli/run.rs +++ b/lib/crates/fabro-workflows/src/cli/run.rs @@ -456,11 +456,15 @@ pub async fn run_command( // 3. Create logs directory let run_id = args.run_id.unwrap_or_else(|| ulid::Ulid::new().to_string()); let run_dir = args.run_dir.unwrap_or_else(|| { - let base = dirs::home_dir() - .expect("could not determine home directory") - .join(".fabro") - .join("runs"); - base.join(format!("{}-{}", Local::now().format("%Y%m%d"), run_id)) + if args.dry_run { + std::env::temp_dir().join("fabro-dry-run").join(&run_id) + } else { + let base = dirs::home_dir() + .expect("could not determine home directory") + .join(".fabro") + .join("runs"); + base.join(format!("{}-{}", Local::now().format("%Y%m%d"), run_id)) + } }); tokio::fs::create_dir_all(&run_dir).await?; fabro_util::run_log::activate(&run_dir.join("cli.log")) @@ -1676,15 +1680,19 @@ async fn run_from_branch( // Set up logs directory let run_dir = args.run_dir.unwrap_or_else(|| { - let base = dirs::home_dir() - .expect("could not determine home directory") - .join(".fabro") - .join("runs"); - base.join(format!( - "{}-{}", - chrono::Local::now().format("%Y%m%d"), - run_id - )) + if args.dry_run { + std::env::temp_dir().join("fabro-dry-run").join(&run_id) + } else { + let base = dirs::home_dir() + .expect("could not determine home directory") + .join(".fabro") + .join("runs"); + base.join(format!( + "{}-{}", + chrono::Local::now().format("%Y%m%d"), + run_id + )) + } }); tokio::fs::create_dir_all(&run_dir).await?; fabro_util::run_log::activate(&run_dir.join("cli.log")) diff --git a/test/docs/run_tests.sh b/test/docs/run_tests.sh index 406b3f98d..7e772b7fb 100755 --- a/test/docs/run_tests.sh +++ b/test/docs/run_tests.sh @@ -12,7 +12,8 @@ PARALLEL="${PARALLEL:-1}" [[ "$VERBOSE" == "1" ]] && PARALLEL=1 RESULTS_DIR="$(mktemp -d)" -trap 'rm -rf "$RESULTS_DIR"' EXIT +RUNS_DIR="$(mktemp -d)" +trap 'rm -rf "$RESULTS_DIR" "$RUNS_DIR"' EXIT # Capture command output to log file; when VERBOSE=1, also stream to terminal. capture() { @@ -77,6 +78,7 @@ run_one() { local flags=(--auto-approve) [[ "$PHASE" == "dry-run" ]] && flags+=(--dry-run) [[ "$PHASE" == "haiku" ]] && flags+=(--model claude-haiku-4-5) + [[ "$PHASE" != "dry-run" ]] && flags+=(--run-dir "$RUNS_DIR/$(echo "$rel" | tr '/' '_')") if (cd "$dot_dir" && capture "$result_file.log" "$ARC" run start "$target" "${flags[@]}"); then echo "PASS" > "$result_file"