Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
refactor(verbose): -vv pointer names diagnostic.md; finish output_log rename (#2919)
Maximilian Roos45b4df336c6d
diff --git a/src/diagnostic.rs b/src/diagnostic.rsindex 80e36af88..a9fa0d4d6 100644--- a/src/diagnostic.rs+++ b/src/diagnostic.rs@@ -105,12 +105,12 @@ Shell integration: {{ shell_integration }}```</details>{%- endif %}-{%- if output_log_path %}+{%- if subprocess_log_path %}<details><summary>Raw subprocess output</summary>-Full captured stdout/stderr is in `{{ output_log_path }}` — not inlined because it can be multi-MB.+Full captured stdout/stderr is in `{{ subprocess_log_path }}`.</details>{%- endif %}"#;@@ -167,7 +167,7 @@ impl DiagnosticReport {.filter(|s| !s.is_empty());// Forward slashes on both platforms so the rendered markdown reads the// same in bug reports regardless of where it was produced.- let output_log_path = crate::log_files::SUBPROCESS+ let subprocess_log_path = crate::log_files::SUBPROCESS.path().map(|p| path_slash::PathExt::to_slash_lossy(p.as_path()).into_owned());@@ -186,7 +186,7 @@ impl DiagnosticReport {worktree_list,config_show,trace_log,- output_log_path,+ subprocess_log_path,}).unwrap()}diff --git a/src/logging.rs b/src/logging.rsindex 799a68769..78a46a458 100644--- a/src/logging.rs+++ b/src/logging.rs@@ -492,19 +492,23 @@ fn announce_trace_destination() {// file. The (Some, None) case (trace.log open, subprocess.log failed) is// rare but real (path-type mismatch, fs quota); the reverse is// possible too but `subprocess.log` alone has no `$ cmd` context, so we- // stay silent there.+ // stay silent there. `diagnostic.md` is named even though it's written+ // at exit (not init) — by the time the user reads the pointer and looks+ // for files, all three will be there.let Some(trace_path) = log_files::TRACE.path() else {return;};- let trace_display = worktrunk::path::format_path_for_display(&trace_path);+ // trace.log is always at `<git>/wt/logs/trace.log` (see `log_files::try_create`),+ // so the parent is structurally guaranteed.+ let dir = trace_path.parent().expect("trace.log path has a parent");+ let dir_display = worktrunk::path::format_path_for_display(dir);let msg = match log_files::SUBPROCESS.path() {- Some(output_path) => {- let output_display = worktrunk::path::format_path_for_display(&output_path);- cformat!(- "Tracing to <underline>{trace_display}</> (raw subprocess output @ <underline>{output_display}</>)"- )- }- None => cformat!("Tracing to <underline>{trace_display}</> (subprocess.log unavailable)"),+ Some(_) => cformat!(+ "Writing to <underline>{dir_display}/</> — trace.log, subprocess.log, diagnostic.md"+ ),+ None => cformat!(+ "Writing to <underline>{dir_display}/</> — trace.log, diagnostic.md (subprocess.log unavailable)"+ ),};eprintln!("{}", info_message(msg));}diff --git a/tests/integration_tests/diagnostic.rs b/tests/integration_tests/diagnostic.rsindex 82ee388e4..f56659f7e 100644--- a/tests/integration_tests/diagnostic.rs+++ b/tests/integration_tests/diagnostic.rs@@ -312,10 +312,10 @@ fn test_log_files_created(mut repo: TestRepo) {let logs_dir = repo.root_path().join(".git").join("wt/logs");let trace_log = logs_dir.join("trace.log");- let output_log = logs_dir.join("subprocess.log");+ let subprocess_log = logs_dir.join("subprocess.log");assert!(trace_log.exists(), "trace.log should be created with -vv");assert!(- output_log.exists(),+ subprocess_log.exists(),"subprocess.log should be created with -vv");@@ -444,7 +444,7 @@ fn test_vv_debug_pipeline_silent_on_stderr(repo: TestRepo) {// Stderr at -vv should contain the new pointer line (and the existing// diagnostic line), so the user knows where the trace went.assert!(- stderr.contains("Tracing to") && stderr.contains("trace.log"),+ stderr.contains("Writing to") && stderr.contains("trace.log"),"stderr should announce the trace destination at -vv: {stderr}");}@@ -605,7 +605,7 @@ fn test_vv_writes_diagnostic_on_error(mut repo: TestRepo) {}/// If one of the `-vv` log files can't be opened (here: pre-existing path-/// of the wrong type), the user still gets a "Tracing to ..." pointer for+/// of the wrong type), the user still gets a "Writing to ..." pointer for/// the one that opened, and the elision marker reflects the asymmetric/// state instead of telling a `-vv` user to "rerun with -vv".#[rstest]@@ -624,7 +624,7 @@ fn test_vv_pointer_handles_split_init(repo: TestRepo) {let stderr = String::from_utf8_lossy(&output.stderr);assert!(- stderr.contains("Tracing to") && stderr.contains("trace.log"),+ stderr.contains("Writing to") && stderr.contains("trace.log"),"stderr should point at trace.log even when subprocess.log can't open: {stderr}");assert!(@@ -697,7 +697,7 @@ fn test_vv_outside_repo_no_crash() {// announce_trace_destination took its early-return path.let stderr = String::from_utf8_lossy(&output.stderr);assert!(- !stderr.contains("Tracing to"),+ !stderr.contains("Writing to"),"no startup pointer when trace.log can't open: {stderr}");}diff --git a/tests/snapshots/integration__integration_tests__diagnostic__diagnostic_file_format.snap b/tests/snapshots/integration__integration_tests__diagnostic__diagnostic_file_format.snapindex 926d02df9..1b35fe28a 100644--- a/tests/snapshots/integration__integration_tests__diagnostic__diagnostic_file_format.snap+++ b/tests/snapshots/integration__integration_tests__diagnostic__diagnostic_file_format.snap@@ -64,5 +64,5 @@ Project config: _REPO_/.config/wt.toml<details><summary>Raw subprocess output</summary>-Full captured stdout/stderr is in `_REPO_/.git/wt/logs/subprocess.log` — not inlined because it can be multi-MB.+Full captured stdout/stderr is in `_REPO_/.git/wt/logs/subprocess.log`.</details>