Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

docs: correct comments left stale by recent step, diagnostic and merge changes (#4425)

Worktrunk Bot3a6e77a0a762
diff --git a/.config/clawpatch/features/feat_custom_switch_resolve.json b/.config/clawpatch/features/feat_custom_switch_resolve.json
index 9d837446b..1435eaee0 100644
--- a/.config/clawpatch/features/feat_custom_switch_resolve.json
+++ b/.config/clawpatch/features/feat_custom_switch_resolve.json
@@ -2,7 +2,7 @@
"schemaVersion": 1,
"featureId": "feat_custom_switch_resolve",
"title": "wt switch + branch resolution: ref-injection, PR fetching, network policy",
- "summary": "`wt switch` resolves user-supplied references (branch names, pr:N, mr:N, gh URLs) and may create worktrees. Branch names can contain hyphens, slashes, special chars — must be passed to git without interpretation as flags. PR/MR fetch is the one place where shelling out to `gh`/`glab` is allowed and must not happen on background paths. See AGENTS.md > Network Access policy and Worktree Model.",
+ "summary": "`wt switch` resolves user-supplied references (branch names, pr:N, mr:N, gh URLs) and may create worktrees. Branch names can contain hyphens, slashes, special chars — must be passed to git without interpretation as flags. PR/MR fetch shells out to `gh`/`glab` and must not happen on background paths. See AGENTS.md > Network Access policy and Worktree Model.",
"kind": "library",
"source": "manual",
"confidence": "high",
diff --git a/.gitignore b/.gitignore
index 8b496315e..d94f40305 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,7 +25,8 @@ test-results/
# clawpatch state lives in .config/clawpatch/ (run with --state-dir
# .config/clawpatch or CLAWPATCH_STATE_DIR=.config/clawpatch). Track only the
# hand-authored threat models and tuned config; findings, the auto-mapped
-# feature, project.json, and per-run state are derived/transient and not.
+# feature, project.json, and per-run state are derived/transient and stay
+# untracked.
/.clawpatch/
/.config/clawpatch/*
!/.config/clawpatch/config.json
diff --git a/src/commands/for_each.rs b/src/commands/for_each.rs
index 09c980e4a..7b8dc1f0d 100644
--- a/src/commands/for_each.rs
+++ b/src/commands/for_each.rs
@@ -7,10 +7,10 @@
//!
//! # Design Notes
//!
-//! The `step` subcommand grouping is not fully satisfying. Current state:
-//!
-//! - `commit`, `squash`, `rebase`, `push` — merge workflow steps (single-worktree)
-//! - `for-each` — utility to run commands across all worktrees (multi-worktree)
+//! The `step` subcommand grouping is not fully satisfying. It holds the merge
+//! workflow's single-worktree steps (`commit`, `squash`, `rebase`, `push`)
+//! alongside unrelated utilities, including `for-each`, the one that runs a
+//! command across all worktrees.
//!
//! These don't naturally belong together. Options considered:
//!
diff --git a/src/commands/merge.rs b/src/commands/merge.rs
index e06b2d17c..ca900685b 100644
--- a/src/commands/merge.rs
+++ b/src/commands/merge.rs
@@ -143,9 +143,9 @@ fn approve_merge_plan(
let project_config = repo.load_project_config()?;
let mut builder = HookPlanBuilder::new(project_config.as_ref(), config, pid);
builder.add(feature_root, &feature_hooks);
- // `post-merge` runs in the destination, and `post-switch` lands the user
- // there (the feature worktree is removed) — both still selected from the
- // source worktree's config.
+ // `post-merge` runs in the destination. `post-switch` runs there too when
+ // removing the source moves the invoking shell (the source is the current
+ // worktree). Both are still selected from the source worktree's config.
builder.add(destination_path, &[HookType::PostMerge]);
if will_switch {
builder.add(destination_path, &[HookType::PostSwitch]);
diff --git a/src/commands/run_pipeline.rs b/src/commands/run_pipeline.rs
index 37729f9fe..76a8b7559 100644
--- a/src/commands/run_pipeline.rs
+++ b/src/commands/run_pipeline.rs
@@ -363,7 +363,7 @@ mod tests {
}
#[test]
- fn signal_exit_reports_named_signal_and_shell_exit_code() {
+ fn signal_exit_reports_signal_and_shell_exit_code() {
let cases = [
(
15,
diff --git a/src/diagnostic.rs b/src/diagnostic.rs
index 6927eec21..5094460ae 100644
--- a/src/diagnostic.rs
+++ b/src/diagnostic.rs
@@ -27,7 +27,9 @@
//! bug (issue #3322: `wt config show` suspending on a pager write)
//! 5. **Worktrees** — Raw `git worktree list --porcelain` output
//! 6. **Config** — User and project config contents
-//! 7. **Verbose log** — Debug log output, truncated to ~50KB if large
+//! 7. **Trace log** — `trace.log` contents, truncated to the last ~50KB
+//! 8. **Raw subprocess output** — Path to `subprocess.log`, which holds the full
+//! captured stdout/stderr (the report links it rather than inlining it)
//!
//! # Privacy
//!
@@ -289,7 +291,8 @@ impl DiagnosticReport {
/// Write the diagnostic report to a file.
///
- /// Called from `write_if_verbose()` when verbose >= 2.
+ /// Called from `write_diagnostic()`, which `write_if_verbose()` runs when
+ /// verbose >= 2.
/// Returns the path if successful, None if write failed.
pub fn write_diagnostic_file(&self, repo: &Repository) -> Option<PathBuf> {
let log_dir = repo.wt_logs_dir();