Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
feat(diagnostic): add -vv flag for diagnostic report generation (#472)
Maximilian Roos6665c128d42c
diff --git a/.claude-plugin/skills/worktrunk/reference/config.md b/.claude-plugin/skills/worktrunk/reference/config.mdindex d6bb859d2..dcf45358d 100644--- a/.claude-plugin/skills/worktrunk/reference/config.md+++ b/.claude-plugin/skills/worktrunk/reference/config.md@@ -287,8 +287,8 @@ Usage: <b><span class=c>wt config</span></b> <span class=c>[OPTIONS]</span> <spa<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)## wt config create@@ -622,8 +622,8 @@ Usage: <b><span class=c>wt config create</span></b> <span class=c>[OPTIONS]</spa<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)## wt config show@@ -664,8 +664,8 @@ Usage: <b><span class=c>wt config show</span></b> <span class=c>[OPTIONS]</span><b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)## wt config state@@ -739,8 +739,8 @@ Usage: <b><span class=c>wt config state</span></b> <span class=c>[OPTIONS]</span<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)## wt config state default-branch@@ -791,8 +791,8 @@ Usage: <b><span class=c>wt config state default-branch</span></b> <span class=c><b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)## wt config state ci-status@@ -841,8 +841,8 @@ Usage: <b><span class=c>wt config state ci-status</span></b> <span class=c>[OPTI<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)## wt config state marker@@ -897,8 +897,8 @@ Usage: <b><span class=c>wt config state marker</span></b> <span class=c>[OPTIONS<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)## wt config state logs@@ -961,5 +961,5 @@ Usage: <b><span class=c>wt config state logs</span></b> <span class=c>[OPTIONS]<<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)diff --git a/.claude-plugin/skills/worktrunk/reference/hook.md b/.claude-plugin/skills/worktrunk/reference/hook.mdindex 7650630cf..ccbe1e916 100644--- a/.claude-plugin/skills/worktrunk/reference/hook.md+++ b/.claude-plugin/skills/worktrunk/reference/hook.md@@ -481,8 +481,8 @@ Usage: <b><span class=c>wt hook</span></b> <span class=c>[OPTIONS]</span> <span<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)## wt hook approvals@@ -530,5 +530,5 @@ Usage: <b><span class=c>wt hook approvals</span></b> <span class=c>[OPTIONS]</sp<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)diff --git a/.claude-plugin/skills/worktrunk/reference/list.md b/.claude-plugin/skills/worktrunk/reference/list.mdindex 033c68a0d..d6784e161 100644--- a/.claude-plugin/skills/worktrunk/reference/list.md+++ b/.claude-plugin/skills/worktrunk/reference/list.md@@ -276,5 +276,5 @@ Usage: <b><span class=c>wt list</span></b> <span class=c>[OPTIONS]</span><b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)diff --git a/.claude-plugin/skills/worktrunk/reference/merge.md b/.claude-plugin/skills/worktrunk/reference/merge.mdindex d7299a900..9f185d72f 100644--- a/.claude-plugin/skills/worktrunk/reference/merge.md+++ b/.claude-plugin/skills/worktrunk/reference/merge.md@@ -114,5 +114,5 @@ Usage: <b><span class=c>wt merge</span></b> <span class=c>[OPTIONS]</span> <span<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)diff --git a/.claude-plugin/skills/worktrunk/reference/remove.md b/.claude-plugin/skills/worktrunk/reference/remove.mdindex d02dc868b..409ab8738 100644--- a/.claude-plugin/skills/worktrunk/reference/remove.md+++ b/.claude-plugin/skills/worktrunk/reference/remove.md@@ -97,5 +97,5 @@ Usage: <b><span class=c>wt remove</span></b> <span class=c>[OPTIONS]</span> <spa<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)diff --git a/.claude-plugin/skills/worktrunk/reference/select.md b/.claude-plugin/skills/worktrunk/reference/select.mdindex 99d25cf4f..f73c044ef 100644--- a/.claude-plugin/skills/worktrunk/reference/select.md+++ b/.claude-plugin/skills/worktrunk/reference/select.md@@ -65,5 +65,5 @@ Usage: <b><span class=c>wt select</span></b> <span class=c>[OPTIONS]</span><b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)diff --git a/.claude-plugin/skills/worktrunk/reference/step.md b/.claude-plugin/skills/worktrunk/reference/step.mdindex bbb6d8da2..24af42834 100644--- a/.claude-plugin/skills/worktrunk/reference/step.md+++ b/.claude-plugin/skills/worktrunk/reference/step.md@@ -90,8 +90,8 @@ Usage: <b><span class=c>wt step</span></b> <span class=c>[OPTIONS]</span> <span<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)## wt step for-each@@ -170,5 +170,5 @@ Usage: <b><span class=c>wt step for-each</span></b> <span class=c>[OPTIONS]</spa<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)diff --git a/.claude-plugin/skills/worktrunk/reference/switch.md b/.claude-plugin/skills/worktrunk/reference/switch.mdindex dfffba366..c9305e262 100644--- a/.claude-plugin/skills/worktrunk/reference/switch.md+++ b/.claude-plugin/skills/worktrunk/reference/switch.md@@ -119,5 +119,5 @@ Usage: <b><span class=c>wt switch</span></b> <span class=c>[OPTIONS]</span> <spa<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv)diff --git a/docs/content/config.md b/docs/content/config.mdindex 8941cd9fc..3f6b12ca0 100644--- a/docs/content/config.md+++ b/docs/content/config.md@@ -296,8 +296,8 @@ Usage: <b><span class=c>wt config</span></b> <span class=c>[OPTIONS]</span> <spa<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}## wt config create@@ -633,8 +633,8 @@ Usage: <b><span class=c>wt config create</span></b> <span class=c>[OPTIONS]</spa<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}@@ -678,8 +678,8 @@ Usage: <b><span class=c>wt config show</span></b> <span class=c>[OPTIONS]</span><b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}@@ -756,8 +756,8 @@ Usage: <b><span class=c>wt config state</span></b> <span class=c>[OPTIONS]</span<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}## wt config state default-branch@@ -810,8 +810,8 @@ Usage: <b><span class=c>wt config state default-branch</span></b> <span class=c><b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}@@ -863,8 +863,8 @@ Usage: <b><span class=c>wt config state ci-status</span></b> <span class=c>[OPTI<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}@@ -922,8 +922,8 @@ Usage: <b><span class=c>wt config state marker</span></b> <span class=c>[OPTIONS<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}@@ -989,8 +989,8 @@ Usage: <b><span class=c>wt config state logs</span></b> <span class=c>[OPTIONS]<<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}<!-- END AUTO-GENERATED from `wt config --help-page` -->diff --git a/docs/content/hook.md b/docs/content/hook.mdindex 53a6cc9a8..768a1d99d 100644--- a/docs/content/hook.md+++ b/docs/content/hook.md@@ -496,8 +496,8 @@ Usage: <b><span class=c>wt hook</span></b> <span class=c>[OPTIONS]</span> <span<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}## wt hook approvals@@ -547,8 +547,8 @@ Usage: <b><span class=c>wt hook approvals</span></b> <span class=c>[OPTIONS]</sp<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}<!-- END AUTO-GENERATED from `wt hook --help-page` -->diff --git a/docs/content/list.md b/docs/content/list.mdindex 265782092..327bfb5a9 100644--- a/docs/content/list.md+++ b/docs/content/list.md@@ -314,8 +314,8 @@ Usage: <b><span class=c>wt list</span></b> <span class=c>[OPTIONS]</span><b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}<!-- END AUTO-GENERATED from `wt list --help-page` -->diff --git a/docs/content/merge.md b/docs/content/merge.mdindex 7110d46ac..cf374e80a 100644--- a/docs/content/merge.md+++ b/docs/content/merge.md@@ -136,8 +136,8 @@ Usage: <b><span class=c>wt merge</span></b> <span class=c>[OPTIONS]</span> <span<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}<!-- END AUTO-GENERATED from `wt merge --help-page` -->diff --git a/docs/content/remove.md b/docs/content/remove.mdindex 7d4123cd4..38de82c60 100644--- a/docs/content/remove.md+++ b/docs/content/remove.md@@ -111,8 +111,8 @@ Usage: <b><span class=c>wt remove</span></b> <span class=c>[OPTIONS]</span> <spa<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}<!-- END AUTO-GENERATED from `wt remove --help-page` -->diff --git a/docs/content/select.md b/docs/content/select.mdindex 9b2b6a604..c3a7b8f9f 100644--- a/docs/content/select.md+++ b/docs/content/select.md@@ -86,8 +86,8 @@ Usage: <b><span class=c>wt select</span></b> <span class=c>[OPTIONS]</span><b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}<!-- END AUTO-GENERATED from `wt select --help-page` -->diff --git a/docs/content/step.md b/docs/content/step.mdindex c1021bbad..53669f3ba 100644--- a/docs/content/step.md+++ b/docs/content/step.md@@ -104,8 +104,8 @@ Usage: <b><span class=c>wt step</span></b> <span class=c>[OPTIONS]</span> <span<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}## wt step for-each@@ -186,8 +186,8 @@ Usage: <b><span class=c>wt step for-each</span></b> <span class=c>[OPTIONS]</spa<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}<!-- END AUTO-GENERATED from `wt step --help-page` -->diff --git a/docs/content/switch.md b/docs/content/switch.mdindex 527cf9c27..ca707a9b3 100644--- a/docs/content/switch.md+++ b/docs/content/switch.md@@ -142,8 +142,8 @@ Usage: <b><span class=c>wt switch</span></b> <span class=c>[OPTIONS]</span> <spa<b><span class=c>--config</span></b><span class=c> <path></span>User config file path- <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b>- Show commands and debug info+ <b><span class=c>-v</span></b>, <b><span class=c>--verbose</span></b><span class=c>...</span>+ Show debug info (-v), or also write diagnostic report (-vv){% end %}<!-- END AUTO-GENERATED from `wt switch --help-page` -->diff --git a/src/cli/mod.rs b/src/cli/mod.rsindex 0977b3ad7..ca8a801a4 100644--- a/src/cli/mod.rs+++ b/src/cli/mod.rs@@ -206,15 +206,16 @@ pub struct Cli {)]pub config: Option<std::path::PathBuf>,- /// Show commands and debug info+ /// Show debug info (-v), or also write diagnostic report (-vv)#[arg(long,short = 'v',global = true,+ action = clap::ArgAction::Count,display_order = 102,help_heading = "Global Options")]- pub verbose: bool,+ pub verbose: u8,#[command(subcommand)]pub command: Option<Commands>,diff --git a/src/commands/list/collect.rs b/src/commands/list/collect.rsindex cd9b65b99..ef2f46d87 100644--- a/src/commands/list/collect.rs+++ b/src/commands/list/collect.rs@@ -52,7 +52,6 @@ use worktrunk::git::{LineDiff, Repository, Worktree};use worktrunk::styling::{INFO_SYMBOL, format_with_gutter, warning_message};use crate::commands::is_worktree_at_expected_path_with;-use crate::diagnostic::DiagnosticReport;use super::ci_status::PrStatus;use super::model::{@@ -1102,14 +1101,15 @@ pub fn collect(}diag.push_str(- "\n\nThis likely indicates a git command hung. Run with --verbose for details.",+ "\n\nThis likely indicates a git command hung. Run with -v for details, -vv to create a diagnostic file.",);crate::output::print(warning_message(&diag))?;- // Show issue reporting hint (writes diagnostic file if --verbose was used)- let report = DiagnosticReport::collect(repo, diag);- crate::output::print(worktrunk::styling::hint_message(report.issue_hint(repo)))?;+ // Show issue reporting hint (free function - doesn't collect diagnostic data)+ crate::output::print(worktrunk::styling::hint_message(+ crate::diagnostic::issue_hint(),+ ))?;}// Compute status symbols for prunable worktrees (skipped during task spawning).@@ -1203,9 +1203,10 @@ pub fn collect(let warning = warning_parts.join("\n");crate::output::print(warning_message(&warning))?;- // Show issue reporting hint (writes diagnostic file if --verbose was used)- let report = DiagnosticReport::collect(repo, warning);- crate::output::print(worktrunk::styling::hint_message(report.issue_hint(repo)))?;+ // Show issue reporting hint (free function - doesn't collect diagnostic data)+ crate::output::print(worktrunk::styling::hint_message(+ crate::diagnostic::issue_hint(),+ ))?;}// Populate display fields for all items (used by JSON output and statusline)diff --git a/src/diagnostic.rs b/src/diagnostic.rsindex d67b27a9a..ca68f420a 100644--- a/src/diagnostic.rs+++ b/src/diagnostic.rs@@ -5,28 +5,26 @@//!//! # When Diagnostics Are Generated//!-//! Diagnostic files are only written when `--verbose` is passed. Without verbose-//! logging, the hint simply tells users to re-run with `--verbose`. This ensures-//! the diagnostic file contains useful debug information.+//! Diagnostic files are written when `-vv` is passed. Without `-vv`, the hint+//! simply tells users to run with `-vv`. This ensures the diagnostic file+//! contains useful debug information.//!//! # Report Format//!//! The report is a markdown file designed for easy pasting into GitHub issues://!-//! 1. **Header** — Timestamp and context describing the issue-//! 2. **Diagnostic data** — Collapsed `<details>` block with:-//! - wt version, OS, architecture-//! - git version-//! - Shell integration status-//! - Raw `git worktree list --porcelain` output-//! 3. **Verbose log** — Debug log output, truncated to ~50KB if large+//! 1. **Header** — Timestamp, command that was run, and result+//! 2. **Environment** — wt version, OS, git version, shell integration+//! 3. **Worktrees** — Raw `git worktree list --porcelain` output+//! 4. **Config** — User and project config contents+//! 5. **Verbose log** — Debug log output, truncated to ~50KB if large//!//! # Privacy//!//! The report explicitly documents what IS and ISN'T included://!//! **Included:** worktree paths, branch names, worktree status (prunable, locked),-//! verbose logs, commit messages (in verbose logs)+//! config files, verbose logs, commit messages (in verbose logs)//!//! **Not included:** file contents, credentials//!@@ -38,11 +36,10 @@//! # Usage//!//! ```rust,ignore-//! use crate::diagnostic::DiagnosticReport;+//! use crate::diagnostic::issue_hint;//!-//! // Show hint (writes diagnostic file only if --verbose was used)-//! let report = DiagnosticReport::collect(&repo, "Some git operations failed".into());-//! output::print(hint_message(report.issue_hint(&repo)))?;+//! // Show hint telling user to run with -vv+//! output::print(hint_message(issue_hint()))?;//! ```//!use std::path::PathBuf;@@ -52,7 +49,6 @@ use anyhow::Context;use color_print::cformat;use minijinja::{Environment, context};use worktrunk::git::Repository;-use worktrunk::path::format_path_for_display;use worktrunk::shell_exec::run;use crate::cli::version_str;@@ -65,31 +61,35 @@ use crate::output;const REPORT_TEMPLATE: &str = r#"## Diagnostic Report**Generated:** {{ timestamp }}-**Context:** {{ context }}--### What's included--- wt version, OS, git version-- Worktree paths and branch names-- Worktree status (prunable, locked, etc.)-- Shell integration status-- Verbose logs (if run with --verbose)-- Commit messages (in verbose logs)--Does NOT contain: file contents, credentials.+**Command:** `{{ command }}`+**Result:** {{ context }}<details>-<summary>Diagnostic data</summary>+<summary>Environment</summary>```wt {{ version }} ({{ os }} {{ arch }})git {{ git_version }}Shell integration: {{ shell_integration }}+```+</details>---- git worktree list --porcelain ---+<details>+<summary>Worktrees</summary>++```{{ worktree_list }}```</details>+{% if config_show %}+<details>+<summary>Config</summary>++```+{{ config_show }}+```+</details>+{% endif %}{% if verbose_log %}<details><summary>Verbose log</summary>@@ -112,14 +112,15 @@ impl DiagnosticReport {////// # Arguments/// * `repo` - Repository to collect worktree info from- /// * `context` - Context describing the issue (error message, affected item)- pub fn collect(repo: &Repository, context: String) -> Self {- let content = Self::format_report(repo, &context);+ /// * `command` - The command that was run (e.g., "wt list -vv")+ /// * `context` - Context describing the result (error message or success)+ pub fn collect(repo: &Repository, command: &str, context: String) -> Self {+ let content = Self::format_report(repo, command, &context);Self { content }}/// Format the complete diagnostic report as markdown using minijinja template.- fn format_report(repo: &Repository, context: &str) -> String {+ fn format_report(repo: &Repository, command: &str, context: &str) -> String {// Strip ANSI codes from context - the diagnostic is a markdown file for GitHublet context = strip_ansi_codes(context);@@ -139,6 +140,9 @@ impl DiagnosticReport {.map(|s| s.trim_end().to_string()).unwrap_or_else(|_| "(failed to get worktree list)".to_string());+ // Get config show output (if available)+ let config_show = get_config_show_output(repo);+// Get verbose log content (if available)let verbose_log = crate::verbose_log::log_file_path().and_then(|path| std::fs::read_to_string(&path).ok())@@ -150,6 +154,7 @@ impl DiagnosticReport {let tmpl = env.template_from_str(REPORT_TEMPLATE).unwrap();tmpl.render(context! {timestamp,+ command,context,version,os,@@ -157,39 +162,12 @@ impl DiagnosticReport {git_version,shell_integration,worktree_list,+ config_show,verbose_log,}).unwrap()}- /// Write diagnostic file (if verbose) and return issue reporting hint.- ///- /// If verbose logging is active: writes diagnostic file, returns hint with gh command.- /// Otherwise: returns hint to re-run with --verbose (no file written).- pub fn issue_hint(&self, repo: &Repository) -> String {- if !crate::verbose_log::is_active() {- return cformat!("To create a diagnostic file, re-run with <bright-black>--verbose</>");- }-- // Write the diagnostic file- let Some(path) = self.write_file(repo) else {- return "Failed to write diagnostic file".to_string();- };-- let path_display = format_path_for_display(&path);- let mut hint = format!("Diagnostic saved: {path_display}");-- if is_gh_installed() {- // Escape single quotes for shell: 'it'\''s' -> it's- let path_str = path.to_string_lossy().replace('\'', "'\\''");- hint.push_str(&cformat!(- "\n <bright-black>gh issue create -R max-sixty/worktrunk -t 'Bug report' --body-file '{path_str}'</>"- ));- }-- hint- }-/// Write the diagnostic report to a file.fn write_file(&self, repo: &Repository) -> Option<PathBuf> {let log_dir = repo.wt_logs_dir().ok()?;@@ -200,17 +178,26 @@ impl DiagnosticReport {Some(path)}-}-/// Check if the GitHub CLI (gh) is installed.-fn is_gh_installed() -> bool {- let mut cmd = Command::new("gh");- cmd.args(["--version"]);- cmd.stdin(Stdio::null());+ /// Write the diagnostic report to a file (for -vv flag).+ ///+ /// Called from `write_vv_diagnostic()` in main.rs when verbose >= 2.+ /// Returns the path if successful, None if write failed.+ pub fn write_diagnostic_file(&self, repo: &Repository) -> Option<PathBuf> {+ self.write_file(repo)+ }+}- run(&mut cmd, None)- .map(|o| o.status.success())- .unwrap_or(false)+/// Return hint telling users to run with `-vv` for diagnostics.+///+/// This is a free function (not a method on DiagnosticReport) because it+/// doesn't require collecting diagnostic data - just returns a static hint.+///+/// TODO: Consider showing this hint automatically when any `log::warn!` occurs+/// during command execution, since runtime warnings often indicate unexpected+/// conditions that could be bugs worth reporting.+pub fn issue_hint() -> String {+ cformat!("To create a diagnostic file, run with <bright-black>-vv</>")}/// Strip ANSI escape codes from a string.@@ -259,13 +246,134 @@ fn get_git_version() -> anyhow::Result<String> {Ok(version)}+/// Get config show output for diagnostic.+///+/// Returns a summary of user and project config files.+fn get_config_show_output(repo: &Repository) -> Option<String> {+ let mut output = String::new();++ // User config+ if let Some(user_config_path) = worktrunk::config::get_config_path() {+ output.push_str(&format_config_section(&user_config_path, "User config"));+ }++ // Project config+ if let Ok(root) = repo.worktree_root() {+ let project_config_path = root.join(".config/wt.toml");+ output.push_str(&format!(+ "\n{}",+ format_config_section(&project_config_path, "Project config")+ ));+ }++ if output.is_empty() {+ None+ } else {+ Some(output.trim().to_string())+ }+}++/// Format a config file section for diagnostic output.+fn format_config_section(path: &std::path::Path, label: &str) -> String {+ let mut output = format!("{}: {}\n", label, path.display());+ if path.exists() {+ match std::fs::read_to_string(path) {+ Ok(content) if content.trim().is_empty() => output.push_str("(empty file)\n"),+ Ok(content) => {+ // Include content, but truncate if very long+ let content = if content.len() > 4000 {+ format!("{}...\n(truncated)", &content[..4000])+ } else {+ content+ };+ output.push_str(&content);+ if !output.ends_with('\n') {+ output.push('\n');+ }+ }+ Err(e) => output.push_str(&format!("(read failed: {})\n", e)),+ }+ } else {+ output.push_str("(file not found)\n");+ }+ output+}+#[cfg(test)]mod tests {use super::*;+ use tempfile::TempDir;++ #[test]+ fn test_format_config_section_file_not_found() {+ let result = format_config_section(std::path::Path::new("/nonexistent/path.toml"), "Test");+ assert!(result.contains("Test: /nonexistent/path.toml"));+ assert!(result.contains("(file not found)"));+ }++ #[test]+ fn test_format_config_section_empty_file() {+ let tmp = TempDir::new().unwrap();+ let path = tmp.path().join("empty.toml");+ std::fs::write(&path, "").unwrap();++ let result = format_config_section(&path, "Test");+ assert!(result.contains("(empty file)"));+ }++ #[test]+ fn test_format_config_section_with_content() {+ let tmp = TempDir::new().unwrap();+ let path = tmp.path().join("config.toml");+ std::fs::write(&path, "key = \"value\"\n").unwrap();++ let result = format_config_section(&path, "Test");+ assert!(result.contains("key = \"value\""));+ }++ #[test]+ fn test_format_config_section_adds_trailing_newline() {+ let tmp = TempDir::new().unwrap();+ let path = tmp.path().join("config.toml");+ std::fs::write(&path, "no-newline").unwrap();++ let result = format_config_section(&path, "Test");+ assert!(result.ends_with('\n'));+ }++ #[test]+ fn test_format_config_section_truncates_long_content() {+ let tmp = TempDir::new().unwrap();+ let path = tmp.path().join("big.toml");+ let content = "x".repeat(5000);+ std::fs::write(&path, &content).unwrap();++ let result = format_config_section(&path, "Test");+ assert!(result.contains("(truncated)"));+ assert!(result.len() < 5000);+ }++ #[test]+ fn test_strip_ansi_codes() {+ // Build ANSI codes programmatically to avoid lint+ let esc = '\x1b';+ let input = format!("{esc}[31mred{esc}[0m and {esc}[32mgreen{esc}[0m");+ let result = strip_ansi_codes(&input);+ assert_eq!(result, "red and green");+ }++ #[test]+ fn test_truncate_log_small_content() {+ let content = "small log content";+ let result = truncate_log(content);+ assert_eq!(result, content);+ }#[test]- fn test_is_gh_installed_returns_bool() {- // Just verify it doesn't panic and returns a bool- let _ = is_gh_installed();+ fn test_truncate_log_large_content() {+ let content = "x".repeat(60 * 1024); // 60KB+ let result = truncate_log(&content);+ assert!(result.starts_with("(log truncated to last ~50KB)"));+ assert!(result.len() < 55 * 1024);}}diff --git a/src/main.rs b/src/main.rsindex 46dc10394..54b1bd653 100644--- a/src/main.rs+++ b/src/main.rs@@ -744,13 +744,17 @@ fn main() {// Configure logging based on --verbose flag or RUST_LOG env var// When --verbose is set, also write logs to .git/wt-logs/verbose.log- if cli.verbose {+ if cli.verbose >= 1 {verbose_log::init();}+ // Capture verbose level and command line before cli is partially consumed+ let verbose_level = cli.verbose;+ let command_line = std::env::args().collect::<Vec<_>>().join(" ");+// --verbose takes precedence over RUST_LOG: use Builder::new() to ignore env var// Otherwise, respect RUST_LOG (defaulting to off)- let mut builder = if cli.verbose {+ let mut builder = if cli.verbose >= 1 {let mut b = env_logger::Builder::new();b.filter_level(log::LevelFilter::Debug);b@@ -1688,11 +1692,82 @@ fn main() {// Preserve exit code from child processes (especially for signals like SIGINT)let code = exit_code(&e).unwrap_or(1);+ // Write diagnostic if -vv was used (error case)+ write_vv_diagnostic(verbose_level, &command_line, Some(&e.to_string()));+// Reset ANSI state before exitinglet _ = output::terminate_output();process::exit(code);}+ // Write diagnostic if -vv was used (success case)+ write_vv_diagnostic(verbose_level, &command_line, None);+// Reset ANSI state before returning to shell (success case)let _ = output::terminate_output();}++/// Write diagnostic file when -vv is used.+///+/// Called at the end of command execution. If verbose level is >= 2, writes+/// a diagnostic report to `.git/wt-logs/diagnostic.md` for issue filing.+///+/// Silently returns if:+/// - verbose < 2+/// - Not in a git repository+///+/// Warns if diagnostic file write fails.+fn write_vv_diagnostic(verbose: u8, command_line: &str, error_msg: Option<&str>) {+ if verbose < 2 {+ return;+ }++ // Use Repository::current() which honors the -C flag+ let repo = worktrunk::git::Repository::current();++ // Check if we're actually in a git repo+ if repo.git_dir().is_err() {+ return;+ }++ // Build context based on success/error+ let context = match error_msg {+ Some(msg) => format!("Command failed: {msg}"),+ None => "Command completed successfully".to_string(),+ };++ // Collect and write diagnostic+ let report = diagnostic::DiagnosticReport::collect(&repo, command_line, context);+ match report.write_diagnostic_file(&repo) {+ Some(path) => {+ let path_display = format_path_for_display(&path);+ let _ = output::print(info_message(format!("Diagnostic saved: {path_display}")));++ // Only show gh command if gh is installed+ if is_gh_installed() {+ // Escape single quotes for shell: 'it'\''s' -> it's+ let path_str = path.to_string_lossy().replace('\'', "'\\''");+ let _ = output::print(hint_message(cformat!(+ "If this is a bug, create an issue: <bright-black>gh issue create -R max-sixty/worktrunk -t 'Bug report' --body-file '{path_str}'</>"+ )));+ }+ }+ None => {+ let _ = output::print(warning_message("Failed to write diagnostic file"));+ }+ }+}++/// Check if the GitHub CLI (gh) is installed.+fn is_gh_installed() -> bool {+ use std::process::{Command, Stdio};+ use worktrunk::shell_exec::run;++ let mut cmd = Command::new("gh");+ cmd.args(["--version"]);+ cmd.stdin(Stdio::null());++ run(&mut cmd, None)+ .map(|o| o.status.success())+ .unwrap_or(false)+}diff --git a/src/verbose_log.rs b/src/verbose_log.rsindex 50ea2fdc8..5b13dea5b 100644--- a/src/verbose_log.rs+++ b/src/verbose_log.rs@@ -92,10 +92,3 @@ fn try_create_log_file() -> Option<(PathBuf, File)> {Some((path, file))}--/// Check if verbose logging to file is active.-pub fn is_active() -> bool {- VERBOSE_LOG- .get()- .is_some_and(|mutex| mutex.lock().is_ok_and(|g| g.is_some()))-}diff --git a/tests/integration_tests/diagnostic.rs b/tests/integration_tests/diagnostic.rsindex 03b326c13..76a2509a8 100644--- a/tests/integration_tests/diagnostic.rs+++ b/tests/integration_tests/diagnostic.rs@@ -6,12 +6,12 @@//! # Test Coverage//!//! - `test_diagnostic_report_file_format`: Snapshot of full diagnostic structure-//! - `test_diagnostic_not_created_without_verbose`: No file without --verbose-//! - `test_diagnostic_hint_without_verbose`: Hint tells user to use --verbose+//! - `test_diagnostic_not_created_without_vv`: No file without -vv+//! - `test_diagnostic_hint_without_vv`: Hint tells user to use -vv//! - `test_diagnostic_contains_required_sections`: All sections present//! - `test_diagnostic_context_has_no_ansi_codes`: ANSI stripped for GitHub//! - `test_diagnostic_verbose_log_contains_git_commands`: Log has useful data-//! - `test_diagnostic_shows_gh_command_hint`: gh CLI suggestion when available+//! - `test_diagnostic_saved_message_with_vv`: Output shows "Diagnostic saved" with -vv//! - `test_diagnostic_written_to_correct_location`: File in .git/wt-logs/use std::fs;@@ -37,23 +37,19 @@ fn corrupt_worktree_head(repo: &TestRepo, worktree_name: &str) -> PathBuf {head_path}-/// Snapshot the diagnostic report file generated on git errors with --verbose.+/// Snapshot the diagnostic report file generated with -vv.///-/// This test triggers a git error (invalid HEAD) which causes `wt list --verbose`+/// This test triggers a git error (invalid HEAD) and runs `wt list -vv`/// to generate a diagnostic report file. We then read and snapshot the file/// to verify its structure.///-/// Note: Diagnostic files are only generated when --verbose is used.+/// Note: Diagnostic files are only generated when -vv is used.#[rstest]fn test_diagnostic_report_file_format(mut repo: TestRepo) {repo.add_worktree("feature");corrupt_worktree_head(&repo, "feature");- let output = repo- .wt_command()- .args(["list", "--verbose"])- .output()- .unwrap();+ let output = repo.wt_command().args(["list", "-vv"]).output().unwrap();let diagnostic_path = repo.root_path()@@ -68,10 +64,10 @@ fn test_diagnostic_report_file_format(mut repo: TestRepo) {let content = fs::read_to_string(&diagnostic_path).unwrap();- // Verify verbose log section is present (requires --verbose)+ // Verify verbose log section is present (requires -v or higher)assert!(content.contains("<summary>Verbose log</summary>"),- "Diagnostic should include verbose log section when run with --verbose"+ "Diagnostic should include verbose log section when run with -vv");let settings = setup_snapshot_settings(&repo);@@ -88,16 +84,16 @@ fn test_diagnostic_report_file_format(mut repo: TestRepo) {);}-/// Without --verbose, no diagnostic file should be created.+/// Without -vv, no diagnostic file should be created.///-/// The diagnostic file is only useful with verbose logs, so we don't create-/// an empty/minimal diagnostic when --verbose is not used.+/// The diagnostic file is only created when -vv is used. Running without+/// any verbose flag or with just -v does not create a diagnostic file.#[rstest]-fn test_diagnostic_not_created_without_verbose(mut repo: TestRepo) {+fn test_diagnostic_not_created_without_vv(mut repo: TestRepo) {repo.add_worktree("feature");corrupt_worktree_head(&repo, "feature");- // Run WITHOUT --verbose+ // Run WITHOUT -vvrepo.wt_command().args(["list"]).output().unwrap();// Diagnostic file should NOT exist@@ -108,13 +104,13 @@ fn test_diagnostic_not_created_without_verbose(mut repo: TestRepo) {.join("diagnostic.md");assert!(!diagnostic_path.exists(),- "Diagnostic file should NOT be created without --verbose"+ "Diagnostic file should NOT be created without -vv");}-/// Without --verbose, the hint should tell users to re-run with --verbose.+/// Without -vv, the hint should tell users to re-run with -vv.#[rstest]-fn test_diagnostic_hint_without_verbose(mut repo: TestRepo) {+fn test_diagnostic_hint_without_vv(mut repo: TestRepo) {repo.add_worktree("feature");corrupt_worktree_head(&repo, "feature");@@ -122,13 +118,13 @@ fn test_diagnostic_hint_without_verbose(mut repo: TestRepo) {let stderr = String::from_utf8_lossy(&output.stderr);assert!(- stderr.contains("To create a diagnostic file, re-run with"),- "Should hint to use --verbose. stderr: {}",+ stderr.contains("To create a diagnostic file, run with"),+ "Should hint to use -vv. stderr: {}",stderr);assert!(- stderr.contains("--verbose"),- "Hint should mention --verbose flag. stderr: {}",+ stderr.contains("-vv"),+ "Hint should mention -vv flag. stderr: {}",stderr);}@@ -139,10 +135,7 @@ fn test_diagnostic_contains_required_sections(mut repo: TestRepo) {repo.add_worktree("feature");corrupt_worktree_head(&repo, "feature");- repo.wt_command()- .args(["list", "--verbose"])- .output()- .unwrap();+ repo.wt_command().args(["list", "-vv"]).output().unwrap();let content = fs::read_to_string(repo.root_path()@@ -158,40 +151,35 @@ fn test_diagnostic_contains_required_sections(mut repo: TestRepo) {"Should have header");assert!(content.contains("**Generated:**"), "Should have timestamp");- assert!(content.contains("**Context:**"), "Should have context");+ assert!(content.contains("**Command:**"), "Should have command");+ assert!(content.contains("**Result:**"), "Should have result");- // Privacy notice- assert!(- content.contains("### What's included"),- "Should have privacy section"- );- assert!(- content.contains("Commit messages"),- "Should mention commit messages are included"- );+ // Environment sectionassert!(- content.contains("Does NOT contain:"),- "Should clarify what's excluded"+ content.contains("<summary>Environment</summary>"),+ "Should have environment section");+ assert!(content.contains("wt "), "Should have wt version");+ assert!(content.contains("git "), "Should have git version");assert!(- content.contains("file contents"),- "Should clarify file contents are excluded"+ content.contains("Shell integration:"),+ "Should have shell integration status");- // Diagnostic data section+ // Worktrees sectionassert!(- content.contains("<summary>Diagnostic data</summary>"),- "Should have diagnostic data section"+ content.contains("<summary>Worktrees</summary>"),+ "Should have worktrees section");- assert!(content.contains("wt v"), "Should have wt version");- assert!(content.contains("git "), "Should have git version");assert!(- content.contains("Shell integration:"),- "Should have shell integration status"+ content.contains("refs/heads/"),+ "Should have branch refs in worktree list");++ // Config sectionassert!(- content.contains("git worktree list --porcelain"),- "Should have worktree list output"+ content.contains("<summary>Config</summary>"),+ "Should have config section");// Verbose log section@@ -207,10 +195,7 @@ fn test_diagnostic_context_has_no_ansi_codes(mut repo: TestRepo) {repo.add_worktree("feature");corrupt_worktree_head(&repo, "feature");- repo.wt_command()- .args(["list", "--verbose"])- .output()- .unwrap();+ repo.wt_command().args(["list", "-vv"]).output().unwrap();let content = fs::read_to_string(repo.root_path()@@ -237,10 +222,7 @@ fn test_diagnostic_verbose_log_contains_git_commands(mut repo: TestRepo) {repo.add_worktree("feature");corrupt_worktree_head(&repo, "feature");- repo.wt_command()- .args(["list", "--verbose"])- .output()- .unwrap();+ repo.wt_command().args(["list", "-vv"]).output().unwrap();let content = fs::read_to_string(repo.root_path()@@ -275,43 +257,20 @@ fn test_diagnostic_verbose_log_contains_git_commands(mut repo: TestRepo) {);}-/// When gh CLI is available, should show command to create issue.+/// Diagnostic is saved with -vv and output mentions it.#[rstest]-fn test_diagnostic_shows_gh_command_hint(mut repo: TestRepo) {+fn test_diagnostic_saved_message_with_vv(mut repo: TestRepo) {repo.add_worktree("feature");corrupt_worktree_head(&repo, "feature");- let output = repo- .wt_command()- .args(["list", "--verbose"])- .output()- .unwrap();+ let output = repo.wt_command().args(["list", "-vv"]).output().unwrap();let stderr = String::from_utf8_lossy(&output.stderr);- // Check if gh is installed (the hint varies based on this)- let gh_available = std::process::Command::new("gh")- .arg("--version")- .output()- .map(|o| o.status.success())- .unwrap_or(false);-- if gh_available {- assert!(- stderr.contains("gh issue create"),- "Should show gh command when gh CLI is available. stderr: {}",- stderr- );- assert!(- stderr.contains("--body-file"),- "gh command should use --body-file. stderr: {}",- stderr- );- }- // If gh is not available, just verify diagnostic was saved+ // Verify diagnostic was savedassert!(stderr.contains("Diagnostic saved"),- "Should always mention diagnostic was saved. stderr: {}",+ "Should mention diagnostic was saved. stderr: {}",stderr);}@@ -322,10 +281,7 @@ fn test_diagnostic_written_to_correct_location(mut repo: TestRepo) {repo.add_worktree("feature");corrupt_worktree_head(&repo, "feature");- repo.wt_command()- .args(["list", "--verbose"])- .output()- .unwrap();+ repo.wt_command().args(["list", "-vv"]).output().unwrap();// Should be in .git/wt-logs/ directorylet wt_logs_dir = repo.root_path().join(".git").join("wt-logs");@@ -351,10 +307,7 @@ fn test_verbose_log_file_created(mut repo: TestRepo) {repo.add_worktree("feature");corrupt_worktree_head(&repo, "feature");- repo.wt_command()- .args(["list", "--verbose"])- .output()- .unwrap();+ repo.wt_command().args(["list", "-vv"]).output().unwrap();let verbose_log_path = repo.root_path()@@ -363,7 +316,7 @@ fn test_verbose_log_file_created(mut repo: TestRepo) {.join("verbose.log");assert!(verbose_log_path.exists(),- "verbose.log should be created with --verbose"+ "verbose.log should be created with -vv");let content = fs::read_to_string(&verbose_log_path).unwrap();@@ -374,6 +327,135 @@ fn test_verbose_log_file_created(mut repo: TestRepo) {);}+// =============================================================================+// Tests for -vv verbosity level (always write diagnostic)+// =============================================================================++/// With -vv, diagnostic file should be written even on successful commands.+#[rstest]+fn test_vv_writes_diagnostic_on_success(repo: TestRepo) {+ // Run a successful command with -vv+ let output = repo.wt_command().args(["list", "-vv"]).output().unwrap();++ assert!(output.status.success(), "Command should succeed");++ // Diagnostic file should exist+ let diagnostic_path = repo+ .root_path()+ .join(".git")+ .join("wt-logs")+ .join("diagnostic.md");+ assert!(+ diagnostic_path.exists(),+ "Diagnostic file should be created with -vv even on success"+ );++ // Content should indicate success+ let content = fs::read_to_string(&diagnostic_path).unwrap();+ assert!(+ content.contains("Command completed successfully"),+ "Result should indicate success. Content: {}",+ content+ );++ // stderr should mention diagnostic was saved+ let stderr = String::from_utf8_lossy(&output.stderr);+ assert!(+ stderr.contains("Diagnostic saved"),+ "stderr should mention diagnostic was saved. stderr: {}",+ stderr+ );+}++/// With -vv, diagnostic file should be written on error (same as success case).+#[rstest]+fn test_vv_writes_diagnostic_on_error(mut repo: TestRepo) {+ repo.add_worktree("feature");+ corrupt_worktree_head(&repo, "feature");++ // Run a command that will hit git errors with -vv+ let output = repo.wt_command().args(["list", "-vv"]).output().unwrap();++ // Diagnostic file should exist+ let diagnostic_path = repo+ .root_path()+ .join(".git")+ .join("wt-logs")+ .join("diagnostic.md");+ assert!(+ diagnostic_path.exists(),+ "Diagnostic file should be created with -vv on error"+ );++ // stderr should mention diagnostic was saved+ let stderr = String::from_utf8_lossy(&output.stderr);+ assert!(+ stderr.contains("Diagnostic saved"),+ "stderr should mention diagnostic was saved. stderr: {}",+ stderr+ );+}++/// With just -v (not -vv), diagnostic should NOT be written on successful commands.+/// Diagnostics are only written when -vv is explicitly used (via main.rs hook).+#[rstest]+fn test_v_does_not_write_diagnostic_without_error(repo: TestRepo) {+ // Run a successful command with just -v+ let output = repo.wt_command().args(["list", "-v"]).output().unwrap();++ assert!(output.status.success(), "Command should succeed");++ // Diagnostic file should NOT exist (no error, not -vv)+ let diagnostic_path = repo+ .root_path()+ .join(".git")+ .join("wt-logs")+ .join("diagnostic.md");+ assert!(+ !diagnostic_path.exists(),+ "Diagnostic file should NOT be created with just -v on success"+ );++ // But verbose.log should exist+ let verbose_log_path = repo+ .root_path()+ .join(".git")+ .join("wt-logs")+ .join("verbose.log");+ assert!(+ verbose_log_path.exists(),+ "verbose.log should be created with -v"+ );+}++/// With -vv outside a git repo, command should still work (no crash).+#[test]+fn test_vv_outside_repo_no_crash() {+ use crate::common::wt_command;++ // Create a temp directory that is NOT a git repo+ let temp_dir = tempfile::tempdir().unwrap();++ let output = wt_command()+ .args(["--version", "-vv"])+ .current_dir(temp_dir.path())+ .output()+ .unwrap();++ assert!(output.status.success(), "Command should succeed");++ // No diagnostic file should be created (not in a git repo)+ let diagnostic_path = temp_dir+ .path()+ .join(".git")+ .join("wt-logs")+ .join("diagnostic.md");+ assert!(+ !diagnostic_path.exists(),+ "Diagnostic file should NOT be created outside a git repo"+ );+}+/// Normalize the report for snapshot comparison.////// Replaces variable content (versions, paths, timestamps) with placeholders.@@ -386,6 +468,16 @@ fn normalize_report(content: &str) -> String {.replace_all(&result, "[TIMESTAMP]").to_string();+ // Normalize command line path (binary path varies between environments)+ // Matches: `target/debug/wt ...` or `/path/to/wt ...`+ result = regex::Regex::new(r"\*\*Command:\*\* `[^`]+`")+ .unwrap()+ .replace_all(+ &result,+ "**Command:** `[PROJECT_ROOT]/target/debug/wt list -vv`",+ )+ .to_string();+// Normalize wt version line (e.g., "wt v0.9.3-dirty (macos aarch64)" or "wt be89089 (linux x86_64)")// CI builds use commit hashes instead of version numbersresult = regex::Regex::new(r"wt [^ ]+ \([^)]+\)")@@ -417,6 +509,19 @@ fn normalize_report(content: &str) -> String {.replace_all(&result, "[HASH]").to_string();+ // Normalize user config path (must come BEFORE generic repo path normalization)+ result = regex::Regex::new(r"User config: [^\n]+")+ .unwrap()+ .replace_all(&result, "User config: [TEST_CONFIG]")+ .to_string();++ // Normalize project config path (must come BEFORE generic repo path normalization)+ // Handle both Unix (/) and Windows (\) path separators+ result = regex::Regex::new(r"Project config: (?:/|[A-Za-z]:)[^\n]+\.config[/\\]wt\.toml")+ .unwrap()+ .replace_all(&result, "Project config: _REPO_/.config/wt.toml")+ .to_string();+// Normalize temp paths in context (repo paths) - handles both Unix and Windows paths// Unix: /var/folders/.../repo.xxx or /tmp/.../repo.xxx// Windows: D:\a\worktrunk\worktrunk\... or C:\Users\...\repo.xxxdiff --git a/tests/snapshots/integration__integration_tests__diagnostic__diagnostic_file_format.snap b/tests/snapshots/integration__integration_tests__diagnostic__diagnostic_file_format.snapindex e4bb5c792..8f07ae6d1 100644--- a/tests/snapshots/integration__integration_tests__diagnostic__diagnostic_file_format.snap+++ b/tests/snapshots/integration__integration_tests__diagnostic__diagnostic_file_format.snap@@ -5,32 +5,23 @@ expression: normalize_report(&content)## Diagnostic Report**Generated:** [TIMESTAMP]-**Context:** Some git operations failed:- (detached): commit-details (fatal: not a git repository: [REPO_PATH])- (detached): ahead-behind (fatal: not a git repository: [REPO_PATH])- (detached): committed-trees-match (fatal: not a git repository: [REPO_PATH])- (detached): working-tree-diff (fatal: not a git repository: [REPO_PATH])--### What's included--- wt version, OS, git version-- Worktree paths and branch names-- Worktree status (prunable, locked, etc.)-- Shell integration status-- Verbose logs (if run with --verbose)-- Commit messages (in verbose logs)--Does NOT contain: file contents, credentials.+**Command:** `[PROJECT_ROOT]/target/debug/wt list -vv`+**Result:** Command completed successfully<details>-<summary>Diagnostic data</summary>+<summary>Environment</summary>```wt [VERSION] ([OS] [ARCH])git [GIT_VERSION]Shell integration: inactive+```+</details>++<details>+<summary>Worktrees</summary>---- git worktree list --porcelain ---+```worktree [PATH]HEAD [COMMIT]branch refs/heads/main@@ -40,6 +31,19 @@ HEAD [COMMIT]```</details>+<details>+<summary>Config</summary>++```+User config: [TEST_CONFIG]+(file not found)++Project config: _REPO_/.config/wt.toml+(file not found)+```+</details>++<details><summary>Verbose log</summary>diff --git a/tests/snapshots/integration__integration_tests__help__help_config_create.snap b/tests/snapshots/integration__integration_tests__help__help_config_create.snapindex 522c39c2e..a71c1bd63 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_create.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_create.snap@@ -39,8 +39,8 @@ Usage: [1m[36mwt config create[0m [36m[OPTIONS][1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)[32mUser configdiff --git a/tests/snapshots/integration__integration_tests__help__help_config_long.snap b/tests/snapshots/integration__integration_tests__help__help_config_long.snapindex 5d1b3973c..35bb18a7e 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_long.snap@@ -41,8 +41,8 @@ Usage: [1m[36mwt config[0m [36m[OPTIONS][0m [36m<COMMAND>[1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Manages configuration, shell integration, and runtime settings.diff --git a/tests/snapshots/integration__integration_tests__help__help_config_shell.snap b/tests/snapshots/integration__integration_tests__help__help_config_shell.snapindex 7fe587950..071710ab9 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_shell.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_shell.snap@@ -12,6 +12,7 @@ info:GIT_EDITOR: ""RUST_LOG: warnSOURCE_DATE_EPOCH: "1735776000"+ TERM: alacrittyWORKTRUNK_CONFIG_PATH: /nonexistent/test/config.tomlWORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"---@@ -36,4 +37,4 @@ Usage: [1m[36mwt config shell[0m [36m[OPTIONS][0m [36m<COMMAND>[1m[32mGlobal Options:[1m[36m-C[0m[36m [0m[36m<path>[0m Working directory for this command[1m[36m--config[0m[36m [0m[36m<path>[0m User config file path- [1m[36m-v[0m, [1m[36m--verbose[0m Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...[0m Show debug info (-v), or also write diagnostic report (-vv)diff --git a/tests/snapshots/integration__integration_tests__help__help_config_short.snap b/tests/snapshots/integration__integration_tests__help__help_config_short.snapindex 4f24d21fb..8a33e14df 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_short.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_short.snap@@ -11,6 +11,7 @@ info:GIT_EDITOR: ""RUST_LOG: warnSOURCE_DATE_EPOCH: "1735776000"+ TERM: alacrittyWORKTRUNK_CONFIG_PATH: /nonexistent/test/config.tomlWORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"---@@ -35,4 +36,4 @@ Usage: [1m[36mwt config[0m [36m[OPTIONS][0m [36m<COMMAND>[1m[32mGlobal Options:[1m[36m-C[0m[36m [0m[36m<path>[0m Working directory for this command[1m[36m--config[0m[36m [0m[36m<path>[0m User config file path- [1m[36m-v[0m, [1m[36m--verbose[0m Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...[0m Show debug info (-v), or also write diagnostic report (-vv)diff --git a/tests/snapshots/integration__integration_tests__help__help_config_show.snap b/tests/snapshots/integration__integration_tests__help__help_config_show.snapindex ee0d30f72..eb3b8089e 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_show.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_show.snap@@ -12,6 +12,7 @@ info:GIT_EDITOR: ""RUST_LOG: warnSOURCE_DATE_EPOCH: "1735776000"+ TERM: alacrittyWORKTRUNK_CONFIG_PATH: /nonexistent/test/config.tomlWORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"---@@ -38,8 +39,8 @@ Usage: [1m[36mwt config show[0m [36m[OPTIONS][1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Shows location and contents of user config ([2m~/.config/worktrunk/config.toml[0m)and project config ([2m.config/wt.toml[0m).diff --git a/tests/snapshots/integration__integration_tests__help__help_config_state.snap b/tests/snapshots/integration__integration_tests__help__help_config_state.snapindex 8f7103577..8d7b3e489 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_state.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_state.snap@@ -46,8 +46,8 @@ Usage: [1m[36mwt config state[0m [36m[OPTIONS][0m [36m<COMMAND>[1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)State is stored in [2m.git/[0m (config entries and log files), separate from configuration files.Use [2mwt config show[0m to view file-based configuration.diff --git a/tests/snapshots/integration__integration_tests__help__help_config_state_ci_status.snap b/tests/snapshots/integration__integration_tests__help__help_config_state_ci_status.snapindex 4cf2520a4..19c7c84f3 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_state_ci_status.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_state_ci_status.snap@@ -41,8 +41,8 @@ Usage: [1m[36mwt config state ci-status[0m [36m[OPTIONS][0m [36m[COMMAND][1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Caches GitHub/GitLab CI status for display in [2mwt list[0m.diff --git a/tests/snapshots/integration__integration_tests__help__help_config_state_clear.snap b/tests/snapshots/integration__integration_tests__help__help_config_state_clear.snapindex 3730fba00..3c29b47a7 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_state_clear.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_state_clear.snap@@ -37,8 +37,8 @@ Usage: [1m[36mwt config state clear[0m [36m[OPTIONS][1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Clears all stored state:diff --git a/tests/snapshots/integration__integration_tests__help__help_config_state_default_branch.snap b/tests/snapshots/integration__integration_tests__help__help_config_state_default_branch.snapindex 0e689c009..911066730 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_state_default_branch.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_state_default_branch.snap@@ -42,8 +42,8 @@ Usage: [1m[36mwt config state default-branch[0m [36m[OPTIONS][0m [36m[COMM[1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Useful in scripts to avoid hardcoding [2mmain[0m or [2mmaster[0m:diff --git a/tests/snapshots/integration__integration_tests__help__help_config_state_get.snap b/tests/snapshots/integration__integration_tests__help__help_config_state_get.snapindex 34447f93e..9ef8237f0 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_state_get.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_state_get.snap@@ -42,8 +42,8 @@ Usage: [1m[36mwt config state get[0m [36m[OPTIONS][1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Shows all stored state including:diff --git a/tests/snapshots/integration__integration_tests__help__help_config_state_logs.snap b/tests/snapshots/integration__integration_tests__help__help_config_state_logs.snapindex 9aac68673..081819869 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_state_logs.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_state_logs.snap@@ -13,6 +13,7 @@ info:GIT_EDITOR: ""RUST_LOG: warnSOURCE_DATE_EPOCH: "1735776000"+ TERM: alacrittyWORKTRUNK_CONFIG_PATH: /nonexistent/test/config.tomlWORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"---@@ -40,8 +41,8 @@ Usage: [1m[36mwt config state logs[0m [36m[OPTIONS][0m [36m[COMMAND][1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)View and manage logs from background operations.diff --git a/tests/snapshots/integration__integration_tests__help__help_config_state_marker.snap b/tests/snapshots/integration__integration_tests__help__help_config_state_marker.snapindex 728884509..44d013fb3 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_state_marker.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_state_marker.snap@@ -13,6 +13,7 @@ info:GIT_EDITOR: ""RUST_LOG: warnSOURCE_DATE_EPOCH: "1735776000"+ TERM: alacrittyWORKTRUNK_CONFIG_PATH: /nonexistent/test/config.tomlWORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"---@@ -41,8 +42,8 @@ Usage: [1m[36mwt config state marker[0m [36m[OPTIONS][0m [36m[COMMAND][1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Custom status text or emoji shown in the [2mwt list[0m Status column.diff --git a/tests/snapshots/integration__integration_tests__help__help_config_state_previous_branch.snap b/tests/snapshots/integration__integration_tests__help__help_config_state_previous_branch.snapindex 2feb2df09..47b0a8611 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_state_previous_branch.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_state_previous_branch.snap@@ -42,8 +42,8 @@ Usage: [1m[36mwt config state previous-branch[0m [36m[OPTIONS][0m [36m[COM[1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Enables [2mwt switch -[0m to return to the previous worktree, similar to [2mcd -[0m or [2mgit checkout -[0m.diff --git a/tests/snapshots/integration__integration_tests__help__help_hook_approvals.snap b/tests/snapshots/integration__integration_tests__help__help_hook_approvals.snapindex 6bb6f69f8..4372e9186 100644--- a/tests/snapshots/integration__integration_tests__help__help_hook_approvals.snap+++ b/tests/snapshots/integration__integration_tests__help__help_hook_approvals.snap@@ -40,8 +40,8 @@ Usage: [1m[36mwt hook approvals[0m [36m[OPTIONS][0m [36m<COMMAND>[1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Project hooks require approval on first run to prevent untrusted projects from running arbitrary commands.diff --git a/tests/snapshots/integration__integration_tests__help__help_hook_approvals_add.snap b/tests/snapshots/integration__integration_tests__help__help_hook_approvals_add.snapindex 103b3892a..4d8f44378 100644--- a/tests/snapshots/integration__integration_tests__help__help_hook_approvals_add.snap+++ b/tests/snapshots/integration__integration_tests__help__help_hook_approvals_add.snap@@ -13,6 +13,7 @@ info:GIT_EDITOR: ""RUST_LOG: warnSOURCE_DATE_EPOCH: "1735776000"+ TERM: alacrittyWORKTRUNK_CONFIG_PATH: /nonexistent/test/config.tomlWORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"---@@ -39,8 +40,8 @@ Usage: [1m[36mwt hook approvals add[0m [36m[OPTIONS][1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Prompts for approval of all project commands and saves them to user config.diff --git a/tests/snapshots/integration__integration_tests__help__help_hook_approvals_clear.snap b/tests/snapshots/integration__integration_tests__help__help_hook_approvals_clear.snapindex 73d4d8be6..6fc2c1b56 100644--- a/tests/snapshots/integration__integration_tests__help__help_hook_approvals_clear.snap+++ b/tests/snapshots/integration__integration_tests__help__help_hook_approvals_clear.snap@@ -13,6 +13,7 @@ info:GIT_EDITOR: ""RUST_LOG: warnSOURCE_DATE_EPOCH: "1735776000"+ TERM: alacrittyWORKTRUNK_CONFIG_PATH: /nonexistent/test/config.tomlWORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"---@@ -39,8 +40,8 @@ Usage: [1m[36mwt hook approvals clear[0m [36m[OPTIONS][1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Removes saved approvals, requiring re-approval on next command run.diff --git a/tests/snapshots/integration__integration_tests__help__help_list_long.snap b/tests/snapshots/integration__integration_tests__help__help_list_long.snapindex f0bd3aeff..b275a949b 100644--- a/tests/snapshots/integration__integration_tests__help__help_list_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_list_long.snap@@ -58,8 +58,8 @@ Usage: [1m[36mwt list[0m [36m[OPTIONS][1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Show all worktrees with their status. The table includes uncommitted changes, divergence from the default branch and remote, and optional CI status.diff --git a/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap b/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snapindex 8a605c94a..39f2924c4 100644--- a/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap+++ b/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap@@ -59,8 +59,8 @@ Usage: [1m[36mwt list[0m [36m[OPTIONS][1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Show all worktrees with their status. The table includes uncommitted changes,divergence from the default branch and remote, and optional CI status.diff --git a/tests/snapshots/integration__integration_tests__help__help_list_short.snap b/tests/snapshots/integration__integration_tests__help__help_list_short.snapindex 13b8a7245..7f01a3b1c 100644--- a/tests/snapshots/integration__integration_tests__help__help_list_short.snap+++ b/tests/snapshots/integration__integration_tests__help__help_list_short.snap@@ -11,6 +11,7 @@ info:GIT_EDITOR: ""RUST_LOG: warnSOURCE_DATE_EPOCH: "1735776000"+ TERM: alacrittyWORKTRUNK_CONFIG_PATH: /nonexistent/test/config.tomlWORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"---@@ -38,4 +39,4 @@ Usage: [1m[36mwt list[0m [36m[OPTIONS][1m[32mGlobal Options:[1m[36m-C[0m[36m [0m[36m<path>[0m Working directory for this command[1m[36m--config[0m[36m [0m[36m<path>[0m User config file path- [1m[36m-v[0m, [1m[36m--verbose[0m Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...[0m Show debug info (-v), or also write diagnostic report (-vv)diff --git a/tests/snapshots/integration__integration_tests__help__help_md_merge.snap b/tests/snapshots/integration__integration_tests__help__help_md_merge.snapindex 50061b77c..47a824031 100644--- a/tests/snapshots/integration__integration_tests__help__help_md_merge.snap+++ b/tests/snapshots/integration__integration_tests__help__help_md_merge.snap@@ -67,8 +67,8 @@ Global Options:--config <path>User config file path- -v, --verbose- Show commands and debug info+ -v, --verbose...+ Show debug info (-v), or also write diagnostic report (-vv)Merge the current branch into the default branch — like clicking "Merge pull request" on GitHub.<!-- demo: wt-merge.gif 1600x900 -->diff --git a/tests/snapshots/integration__integration_tests__help__help_md_root.snap b/tests/snapshots/integration__integration_tests__help__help_md_root.snapindex 08e069f54..26ed102b3 100644--- a/tests/snapshots/integration__integration_tests__help__help_md_root.snap+++ b/tests/snapshots/integration__integration_tests__help__help_md_root.snap@@ -45,8 +45,8 @@ Global Options:--config <path>User config file path- -v, --verbose- Show commands and debug info+ -v, --verbose...+ Show debug info (-v), or also write diagnostic report (-vv)Getting starteddiff --git a/tests/snapshots/integration__integration_tests__help__help_merge_long.snap b/tests/snapshots/integration__integration_tests__help__help_merge_long.snapindex 2bea6b8b8..e489c50ad 100644--- a/tests/snapshots/integration__integration_tests__help__help_merge_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_merge_long.snap@@ -69,8 +69,8 @@ Usage: [1m[36mwt merge[0m [36m[OPTIONS][0m [36m[TARGET][1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Merge the current branch into the default branch — like clicking "Merge pull request" on GitHub.diff --git a/tests/snapshots/integration__integration_tests__help__help_merge_short.snap b/tests/snapshots/integration__integration_tests__help__help_merge_short.snapindex d2660e5f7..35a30145a 100644--- a/tests/snapshots/integration__integration_tests__help__help_merge_short.snap+++ b/tests/snapshots/integration__integration_tests__help__help_merge_short.snap@@ -11,6 +11,7 @@ info:GIT_EDITOR: ""RUST_LOG: warnSOURCE_DATE_EPOCH: "1735776000"+ TERM: alacrittyWORKTRUNK_CONFIG_PATH: /nonexistent/test/config.tomlWORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"---@@ -39,4 +40,4 @@ Usage: [1m[36mwt merge[0m [36m[OPTIONS][0m [36m[TARGET][1m[32mGlobal Options:[1m[36m-C[0m[36m [0m[36m<path>[0m Working directory for this command[1m[36m--config[0m[36m [0m[36m<path>[0m User config file path- [1m[36m-v[0m, [1m[36m--verbose[0m Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...[0m Show debug info (-v), or also write diagnostic report (-vv)diff --git a/tests/snapshots/integration__integration_tests__help__help_no_args.snap b/tests/snapshots/integration__integration_tests__help__help_no_args.snapindex 72c5b03d2..32addd5f5 100644--- a/tests/snapshots/integration__integration_tests__help__help_no_args.snap+++ b/tests/snapshots/integration__integration_tests__help__help_no_args.snap@@ -39,4 +39,4 @@ Usage: [1m[36mwt[0m [36m[OPTIONS][0m [36m[COMMAND][1m[32mGlobal Options:[1m[36m-C[0m[36m [0m[36m<path>[0m Working directory for this command[1m[36m--config[0m[36m [0m[36m<path>[0m User config file path- [1m[36m-v[0m, [1m[36m--verbose[0m Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...[0m Show debug info (-v), or also write diagnostic report (-vv)diff --git a/tests/snapshots/integration__integration_tests__help__help_page_merge.snap b/tests/snapshots/integration__integration_tests__help__help_page_merge.snapindex cf56b9c9a..6b0badbb7 100644--- a/tests/snapshots/integration__integration_tests__help__help_page_merge.snap+++ b/tests/snapshots/integration__integration_tests__help__help_page_merge.snap@@ -148,8 +148,8 @@ Usage: [1m[36mwt merge[0m [36m[OPTIONS][0m [36m[TARGET][0m[1m[36m--config[0m[36m [0m[36m<path>[0mUser config file path- [1m[36m-v[0m, [1m[36m--verbose[0m- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...[0m+ Show debug info (-v), or also write diagnostic report (-vv)```<!-- END AUTO-GENERATED from `wt merge --help-page` -->diff --git a/tests/snapshots/integration__integration_tests__help__help_page_switch.snap b/tests/snapshots/integration__integration_tests__help__help_page_switch.snapindex 1587278a4..594e3a17d 100644--- a/tests/snapshots/integration__integration_tests__help__help_page_switch.snap+++ b/tests/snapshots/integration__integration_tests__help__help_page_switch.snap@@ -154,8 +154,8 @@ Usage: [1m[36mwt switch[0m [36m[OPTIONS][0m [36m<BRANCH>[0m [1m[36m[--[1m[36m--config[0m[36m [0m[36m<path>[0mUser config file path- [1m[36m-v[0m, [1m[36m--verbose[0m- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...[0m+ Show debug info (-v), or also write diagnostic report (-vv)```<!-- END AUTO-GENERATED from `wt switch --help-page` -->diff --git a/tests/snapshots/integration__integration_tests__help__help_remove_long.snap b/tests/snapshots/integration__integration_tests__help__help_remove_long.snapindex c60938040..515cf41c7 100644--- a/tests/snapshots/integration__integration_tests__help__help_remove_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_remove_long.snap@@ -59,8 +59,8 @@ Usage: [1m[36mwt remove[0m [36m[OPTIONS][0m [36m[BRANCHES]...[1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Removes worktrees and their branches (if merged), returning to the main worktree. Defaults to removing the current worktree.diff --git a/tests/snapshots/integration__integration_tests__help__help_remove_short.snap b/tests/snapshots/integration__integration_tests__help__help_remove_short.snapindex 3ab09ecf7..5fec10230 100644--- a/tests/snapshots/integration__integration_tests__help__help_remove_short.snap+++ b/tests/snapshots/integration__integration_tests__help__help_remove_short.snap@@ -39,4 +39,4 @@ Usage: [1m[36mwt remove[0m [36m[OPTIONS][0m [36m[BRANCHES]...[1m[32mGlobal Options:[1m[36m-C[0m[36m [0m[36m<path>[0m Working directory for this command[1m[36m--config[0m[36m [0m[36m<path>[0m User config file path- [1m[36m-v[0m, [1m[36m--verbose[0m Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...[0m Show debug info (-v), or also write diagnostic report (-vv)diff --git a/tests/snapshots/integration__integration_tests__help__help_root_long.snap b/tests/snapshots/integration__integration_tests__help__help_root_long.snapindex 6415c7622..1267d61f4 100644--- a/tests/snapshots/integration__integration_tests__help__help_root_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_root_long.snap@@ -47,8 +47,8 @@ Usage: [1m[36mwt[0m [36m[OPTIONS][0m [36m[COMMAND][1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Getting starteddiff --git a/tests/snapshots/integration__integration_tests__help__help_root_short.snap b/tests/snapshots/integration__integration_tests__help__help_root_short.snapindex 652176677..7dda419df 100644--- a/tests/snapshots/integration__integration_tests__help__help_root_short.snap+++ b/tests/snapshots/integration__integration_tests__help__help_root_short.snap@@ -40,4 +40,4 @@ Usage: [1m[36mwt[0m [36m[OPTIONS][0m [36m[COMMAND][1m[32mGlobal Options:[1m[36m-C[0m[36m [0m[36m<path>[0m Working directory for this command[1m[36m--config[0m[36m [0m[36m<path>[0m User config file path- [1m[36m-v[0m, [1m[36m--verbose[0m Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...[0m Show debug info (-v), or also write diagnostic report (-vv)diff --git a/tests/snapshots/integration__integration_tests__help__help_step_long.snap b/tests/snapshots/integration__integration_tests__help__help_step_long.snapindex 44b4eb341..f1dd0f6ba 100644--- a/tests/snapshots/integration__integration_tests__help__help_step_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_step_long.snap@@ -43,8 +43,8 @@ Usage: [1m[36mwt step[0m [36m[OPTIONS][0m [36m<COMMAND>[1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Run individual git workflow operations: commits, squashes, rebases, and pushes.diff --git a/tests/snapshots/integration__integration_tests__help__help_step_short.snap b/tests/snapshots/integration__integration_tests__help__help_step_short.snapindex 33402c083..d04bbf000 100644--- a/tests/snapshots/integration__integration_tests__help__help_step_short.snap+++ b/tests/snapshots/integration__integration_tests__help__help_step_short.snap@@ -38,4 +38,4 @@ Usage: [1m[36mwt step[0m [36m[OPTIONS][0m [36m<COMMAND>[1m[32mGlobal Options:[1m[36m-C[0m[36m [0m[36m<path>[0m Working directory for this command[1m[36m--config[0m[36m [0m[36m<path>[0m User config file path- [1m[36m-v[0m, [1m[36m--verbose[0m Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...[0m Show debug info (-v), or also write diagnostic report (-vv)diff --git a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap b/tests/snapshots/integration__integration_tests__help__help_switch_long.snapindex d69a5b5f1..5d82241c4 100644--- a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap@@ -77,8 +77,8 @@ Usage: [1m[36mwt switch[0m [36m[OPTIONS][0m [36m<BRANCH>[0m [1m[36m[--[1m[36m--config[0m[36m [0m[36m<path>User config file path- [1m[36m-v[0m, [1m[36m--verbose- Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...+ Show debug info (-v), or also write diagnostic report (-vv)Change directory to a worktree, creating one if needed.diff --git a/tests/snapshots/integration__integration_tests__help__help_switch_short.snap b/tests/snapshots/integration__integration_tests__help__help_switch_short.snapindex 2cfe16e61..56611ed94 100644--- a/tests/snapshots/integration__integration_tests__help__help_switch_short.snap+++ b/tests/snapshots/integration__integration_tests__help__help_switch_short.snap@@ -11,6 +11,7 @@ info:GIT_EDITOR: ""RUST_LOG: warnSOURCE_DATE_EPOCH: "1735776000"+ TERM: alacrittyWORKTRUNK_CONFIG_PATH: /nonexistent/test/config.tomlWORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"---@@ -39,4 +40,4 @@ Usage: [1m[36mwt switch[0m [36m[OPTIONS][0m [36m<BRANCH>[0m [1m[36m[--[1m[32mGlobal Options:[1m[36m-C[0m[36m [0m[36m<path>[0m Working directory for this command[1m[36m--config[0m[36m [0m[36m<path>[0m User config file path- [1m[36m-v[0m, [1m[36m--verbose[0m Show commands and debug info+ [1m[36m-v[0m, [1m[36m--verbose[0m[36m...[0m Show debug info (-v), or also write diagnostic report (-vv)diff --git a/tests/snapshots/integration__integration_tests__list__list_shows_warning_on_git_error.snap b/tests/snapshots/integration__integration_tests__list__list_shows_warning_on_git_error.snapindex 20cc804c2..3dc54109d 100644--- a/tests/snapshots/integration__integration_tests__list__list_shows_warning_on_git_error.snap+++ b/tests/snapshots/integration__integration_tests__list__list_shows_warning_on_git_error.snap@@ -43,4 +43,4 @@ exit_code: 0[107m [0m working tree.)[107m [0m [1mfeature[22m: has-file-changes (fatal: Invalid symmetric difference expression main...feature)[107m [0m [1mfeature[22m: working-tree-diff (fatal: bad object HEAD)[39m-[2m↳[22m [2mTo create a diagnostic file, re-run with [90m--verbose[39m[22m+[2m↳[22m [2mTo create a diagnostic file, run with [90m-vv[39m[22m