Skip to content

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

refactor(hooks): one canonical hook-announce grammar (#2504)

Maximilian Roos821314a672f3
diff --git a/src/commands/alias.rs b/src/commands/alias.rs
index 8a479563e..f01f92a6d 100644
--- a/src/commands/alias.rs
+++ b/src/commands/alias.rs
@@ -303,8 +303,8 @@ fn unknown_step_command_error(name: &str, alias_names: &[String]) -> anyhow::Err
/// there is nothing beyond the alias name to announce.
///
/// Returns `Some(…)` only when the alias has at least one named step, so the
-/// banner can carry a pipeline summary (e.g., `Running alias deploy: install;
-/// build, lint`). Single unnamed aliases (`ls = "wt list"`) and all-anonymous
+/// banner can carry a pipeline summary (e.g., `Running alias deploy: install,
+/// build & lint`). Single unnamed aliases (`ls = "wt list"`) and all-anonymous
/// pipelines (`foo = ["a", "b"]`) return `None` — the banner would only echo
/// the name the user just typed. Callers that still want a confirmation line
/// (e.g. under `-v`) emit a bare `Running alias <name>` themselves.
@@ -890,7 +890,7 @@ test = "cargo test"
"#,
);
let msg = format_alias_announcement("check", &cfg).expect("summary expected");
- insta::assert_snapshot!(msg.ansi_strip(), @"Running alias check: build, test");
+ insta::assert_snapshot!(msg.ansi_strip(), @"Running alias check: build & test");
}
#[test]
@@ -905,7 +905,7 @@ cmd = [
"#,
);
let msg = format_alias_announcement("deploy", &cfg).expect("summary expected");
- insta::assert_snapshot!(msg.ansi_strip(), @"Running alias deploy: install; build, lint");
+ insta::assert_snapshot!(msg.ansi_strip(), @"Running alias deploy: install, build & lint");
}
#[test]
@@ -921,7 +921,7 @@ cmd = [
"#,
);
let msg = format_alias_announcement("ci", &cfg).expect("summary expected");
- insta::assert_snapshot!(msg.ansi_strip(), @"Running alias ci: build, test");
+ insta::assert_snapshot!(msg.ansi_strip(), @"Running alias ci: build & test");
}
#[test]
@@ -1493,7 +1493,7 @@ cmd = [
]
"#,
);
- assert_eq!(format_alias_summary(&cfg), "install; build, lint");
+ assert_eq!(format_alias_summary(&cfg), "install, build & lint");
}
#[test]
@@ -1508,7 +1508,7 @@ build = "cargo build"
test = "cargo test"
"#,
);
- assert_eq!(format_alias_summary(&cfg), "build, test");
+ assert_eq!(format_alias_summary(&cfg), "build & test");
}
#[test]
diff --git a/src/commands/hooks.rs b/src/commands/hooks.rs
index 3d03b2186..de0c31dee 100644
--- a/src/commands/hooks.rs
+++ b/src/commands/hooks.rs
@@ -1,3 +1,70 @@
+//! # Hook announcement format
+//!
+//! Background hook execution emits a single `Running ...` line covering every
+//! hook type that fires from one event. Separators form a precedence hierarchy
+//! from tightest to loosest:
+//!
+//! ```text
+//! & : concurrent commands within a step (tightest)
+//! , : serial steps within a pipeline
+//! ; : source pipelines within a hook type, AND (loosest)
+//! hook-type clauses within an announce
+//! ```
+//!
+//! `;` is overloaded across the two outermost tiers. The reader disambiguates
+//! by lookahead — `;` followed by a `<hook-type>:` (e.g. `post-start:`) is a
+//! cross-type boundary; otherwise it's a cross-source boundary within the
+//! current hook-type clause. In practice the two often coexist on one line.
+//!
+//! ## Grammar
+//!
+//! ```text
+//! Running <clauses> [@ <path>]
+//!
+//! <clauses> := <hook-clause> ("; " <hook-clause>)*
+//! <hook-clause> := <hook-type> [" for " <branch>] ": " <pipelines>
+//! <pipelines> := <pipeline> | <labeled> ("; " <labeled>)*
+//! <labeled> := <pipeline> " (" <source> ")" # all-named or mixed
+//! | <source> [" ×" N] # all-unnamed (no parens)
+//! <pipeline> := <step> (", " <step>)*
+//! <step> := <command> (" & " <command>)*
+//! <command> := <name> # named
+//! | "…" # unnamed run of 1
+//! | "…×" N # unnamed run of N≥2
+//! ```
+//!
+//! The source label appears **once per pipeline** as a suffix annotation
+//! (`sync, push (user)`), not once per command. The all-unnamed degenerate
+//! case has no body to attach the suffix to, so it stays bare (`user` or
+//! `user ×N`).
+//!
+//! ## Examples
+//!
+//! | Pipeline shape (single source) | Output |
+//! |---|---|
+//! | one named command | `notify (user)` |
+//! | two serial named | `sync, push (user)` |
+//! | one concurrent step | `build & lint (user)` |
+//! | serial then concurrent | `install, build & lint (user)` |
+//! | mixed unnamed + named | `…, bg (user)` (or `…×2, bg (user)`) |
+//! | all unnamed | `user ×2` |
+//!
+//! Multi-source for one hook type: `sync, push (user); build (project)`.
+//!
+//! Multi-type bundle (e.g., `wt merge` firing four hook types):
+//! `Running post-commit: mark (user); post-remove: cleanup (user); post-switch: notify (user); post-merge: sync (user) @ ~/repo`.
+//!
+//! ## Implementation
+//!
+//! - [`format_pipeline_summary_from_names`] produces the bare `<pipeline>`
+//! body (handles `&` / `,` and unnamed-flush). Shared with alias announces.
+//! - [`format_pipeline_summary`] wraps it with the per-pipeline source label,
+//! collapsing the all-unnamed case to the bare `<source>` / `<source> ×N`
+//! form.
+//! - [`run_hooks_background`] joins source summaries with `;` within each
+//! hook-type clause, then joins clauses with `;` into one announce line
+//! with the path suffix at the end.
+
use std::collections::HashMap;
use std::path::{Path, PathBuf};
@@ -171,18 +238,18 @@ pub(crate) fn step_names_from_config(
.collect()
}
-/// Format a pipeline summary from per-step command names.
+/// Format the bare `<pipeline>` body from per-step command names — see the
+/// module-level grammar.
///
/// `step_names[i]` is the list of commands in step `i`; `Some(name)` for named
-/// commands, `None` for unnamed. Serial steps are joined by `;`, concurrent
-/// commands within a step by `,`. Contiguous runs of unnamed commands (across
-/// steps, until the next named command) are collapsed into a single
+/// commands, `None` for unnamed. Serial steps join with `, `; concurrent
+/// commands within a step join with ` & `. Contiguous runs of unnamed commands
+/// (across steps, until the next named command) collapse into a single
/// `label_unnamed(count)` entry; return `None` from that closure to drop
/// unnamed commands entirely.
///
-/// Shared by hook announcements (where unnamed commands collapse to
-/// `user ×N`) and alias announcements (which skip unnamed commands since
-/// aliases have no natural fallback label).
+/// Shared by hook and alias announcements. The caller wraps the body with any
+/// surrounding context (source prefix for hooks, alias name for aliases).
///
/// Note: unnamed commands within a `Concurrent` step aren't reachable from
/// config today — TOML named tables always produce all-named commands, and
@@ -213,7 +280,7 @@ pub(crate) fn format_pipeline_summary_from_names(
parts.push(s);
}
unnamed_count = 0;
- parts.push(named.join(", "));
+ parts.push(named.join(" & "));
}
}
@@ -224,18 +291,16 @@ pub(crate) fn format_pipeline_summary_from_names(
parts.push(s);
}
- parts.join("; ")
+ parts.join(", ")
}
-/// Format a summary description of a hook pipeline for display.
-///
-/// Named steps show as `source:name`; unnamed steps are collapsed into a single
-/// `source ×N` count. Serial steps are separated by `;`, concurrent steps by `,`.
-/// Example: "user:install; user:build, user:lint"
+/// Format a `<labeled>` source pipeline for the announce line — see the
+/// module-level grammar.
///
-/// TODO: The `source:` prefix on named steps may be too verbose when only one
-/// source is present (e.g., `user:bg` vs just `bg`). Consider prefixing only
-/// when both user and project hooks exist for the same hook type.
+/// Returns `<body> (<source>)` for named/mixed pipelines, or the bare
+/// `<source>` / `<source> ×N` form when every command is unnamed (no body to
+/// attach the suffix to). Unnamed runs inside a mixed pipeline render as `…`
+/// (1) or `…×N` (≥2).
fn format_pipeline_summary(steps: &[SourcedStep]) -> String {
// All steps in a group share the same source.
let source_label = steps[0].source.to_string();
@@ -248,30 +313,44 @@ fn format_pipeline_summary(steps: &[SourcedStep]) -> String {
})
.collect();
- format_pipeline_summary_from_names(
+ let total_unnamed: usize = step_names.iter().flatten().filter(|n| n.is_none()).count();
+ let any_named = step_names.iter().flatten().any(|n| n.is_some());
+
+ // All-unnamed degenerate case: no names to list, so skip the colon.
+ if !any_named {
+ return if total_unnamed == 1 {
+ cformat!("<bold>{source_label}</>")
+ } else {
+ cformat!("<bold>{source_label}</> ×{total_unnamed}")
+ };
+ }
+
+ let body = format_pipeline_summary_from_names(
&step_names,
- |name| cformat!("<bold>{source_label}:{name}</>"),
+ |name| cformat!("<bold>{name}</>"),
|count| {
Some(if count == 1 {
- cformat!("<bold>{source_label}</>")
+ "…".to_string()
} else {
- cformat!("<bold>{source_label}</> ×{count}")
+ format!("…×{count}")
})
},
- )
+ );
+ cformat!("{body} (<bold>{source_label}</>)")
}
/// Coordinates background hook announcements within a single `wt` command.
///
/// The principle: one `◎ Running …` line per command. Sites that would have
/// individually spawned background hooks instead `register` their pipelines
-/// here, and the command `flush`es once after all phases have been resolved.
-/// All registered hook types end up on a single combined line, joined by `;`.
+/// here, and the command `flush`es once after all phases have been resolved —
+/// every registered hook type ends up on the same combined announce line, in
+/// registration order, with `;` between clauses (see module spec).
///
/// Just-in-time honesty: registration happens at each phase's normal moment,
/// so if an earlier phase fails (e.g. pre-merge errors before post-merge is
/// queued), the announce only describes hooks that actually ran. The line is
-/// emitted at `flush`, not at the first registration.
+/// emitted at `flush`, not at registration time.
pub struct HookAnnouncer<'a> {
pending: Vec<PendingPipeline>,
repo: &'a Repository,
@@ -292,7 +371,7 @@ struct PendingPipeline {
impl<'a> HookAnnouncer<'a> {
/// `show_branch=true` includes the branch name for disambiguation in batch
/// contexts (e.g., prune removing multiple worktrees):
- /// `Running post-remove for feature: docs; post-switch for feature: zellij-tab`
+ /// `Running post-remove for feature: docs (user); post-switch for feature: zellij-tab (user)`
pub fn new(repo: &'a Repository, config: &'a UserConfig, show_branch: bool) -> Self {
Self {
pending: Vec::new(),
@@ -391,16 +470,15 @@ impl Drop for HookAnnouncer<'_> {
/// `flush` lands here. The function stays separate to keep the announce/spawn
/// formatting isolated from the announcer's pending-list bookkeeping.
///
-/// Displays a single combined summary line covering all hook types, then
-/// spawns each pipeline independently. Pipelines may carry different
-/// `CommandContext`s (e.g., post-remove uses the removed branch while
-/// post-switch uses the destination branch).
-///
-/// When `show_branch` is true, includes the branch name for disambiguation in batch
-/// contexts (e.g., prune removing multiple worktrees):
-/// `Running post-remove for feature: docs; post-switch for feature: zellij-tab`
+/// Emits a single combined `Running ...` line covering every registered hook
+/// type (see module-level grammar), with the path suffix at the end. Pipelines
+/// may carry different `CommandContext`s (e.g., post-remove uses the removed
+/// branch while post-switch uses the destination branch); the announce shares
+/// one line because every bundled clause shares the same path.
///
-/// Without `show_branch`: `Running post-switch: zellij-tab; post-start: deps, assets, docs`
+/// When `show_branch` is true, the announce includes the branch name for
+/// disambiguation in batch contexts (e.g., prune removing multiple worktrees):
+/// `Running post-remove for feature: user: docs`.
fn run_hooks_background(
pipelines: Vec<(CommandContext<'_>, Vec<SourcedStep>)>,
show_branch: bool,
@@ -412,15 +490,13 @@ fn run_hooks_background(
if pipelines.is_empty() {
return Ok(());
}
- // Build combined summary, merging groups with the same hook type:
- // "post-switch: zellij-tab; post-start: deps, assets, docs"
let display_path = pipelines
.iter()
.flat_map(|(_, g)| g.iter())
.find_map(|s| s.display_path.as_ref());
- // Merge summaries by hook type so user+project for the same type
- // shows "post-start: user_bg, project" not "post-start: user_bg; post-start: project".
+ // Merge per-source summaries by hook type so user+project for the same
+ // type render as one clause: `post-merge: sync, push (user); build (project)`.
let mut type_summaries: Vec<(HookType, Vec<String>)> = Vec::new();
for (_, group) in &pipelines {
let hook_type = group[0].hook_type;
@@ -444,12 +520,15 @@ fn run_hooks_background(
None
};
+ if verbosity() >= 1 {
+ for (ht, _) in &type_summaries {
+ print_background_variable_table(&pipelines, *ht);
+ }
+ }
+ let suffix = branch_suffix.as_deref().unwrap_or("");
let combined: String = type_summaries
.iter()
- .map(|(ht, summaries)| {
- let suffix = branch_suffix.as_deref().unwrap_or("");
- format!("{ht}{suffix}: {}", summaries.join(", "))
- })
+ .map(|(ht, summaries)| format!("{ht}{suffix}: {}", summaries.join("; ")))
.collect::<Vec<_>>()
.join("; ");
let message = match display_path {
@@ -459,9 +538,6 @@ fn run_hooks_background(
}
None => format!("Running {combined}"),
};
- if verbosity() >= 1 {
- print_background_variable_tables(&pipelines);
- }
eprintln!("{}", progress_message(message));
for (ctx, group) in pipelines {
@@ -519,18 +595,20 @@ pub(crate) fn prepare_background_pipelines<'c>(
.collect())
}
-/// Emit a `template variables:` block per distinct hook type in `pipelines`.
+/// Emit a `template variables:` block for one hook type, using the first
+/// matching step's context.
///
/// Background hooks don't flow through `announce_command` (which prints the
-/// table in the foreground path), so this is the symmetric entry point: once
-/// per hook type, using the first command's context. `hook_name` within a
-/// table reflects that first command — the combined announce line above
-/// already enumerates the rest.
-fn print_background_variable_tables(pipelines: &[(CommandContext<'_>, Vec<SourcedStep>)]) {
- let mut seen: Vec<HookType> = Vec::new();
+/// table in the foreground path), so this is the symmetric entry point.
+/// Called once per hook type from `run_hooks_background`, immediately before
+/// that hook type's `Running ...` line, so each hook type reads as one block.
+fn print_background_variable_table(
+ pipelines: &[(CommandContext<'_>, Vec<SourcedStep>)],
+ hook_type: HookType,
+) {
for (_, group) in pipelines {
for sourced in group {
- if seen.contains(&sourced.hook_type) {
+ if sourced.hook_type != hook_type {
continue;
}
let cmd = match &sourced.step {
@@ -542,9 +620,9 @@ fn print_background_variable_tables(pipelines: &[(CommandContext<'_>, Vec<Source
eprintln!("{}", info_message("template variables:"));
eprintln!(
"{}",
- format_with_gutter(&format_hook_variables(sourced.hook_type, &ctx), None)
+ format_with_gutter(&format_hook_variables(hook_type, &ctx), None)
);
- seen.push(sourced.hook_type);
+ return;
}
}
}
@@ -902,7 +980,7 @@ mod tests {
])),
];
let summary = format_pipeline_summary(&steps);
- assert_snapshot!(summary.ansi_strip(), @"user:install; user:build, user:lint");
+ assert_snapshot!(summary.ansi_strip(), @"install, build & lint (user)");
}
#[test]
@@ -922,7 +1000,7 @@ mod tests {
make_sourced_step(PreparedStep::Single(make_cmd(Some("bg"), "npm run dev"))),
];
let summary = format_pipeline_summary(&steps);
- assert_snapshot!(summary.ansi_strip(), @"user; user:bg");
+ assert_snapshot!(summary.ansi_strip(), @"…, bg (user)");
}
#[test]
@@ -953,7 +1031,7 @@ mod tests {
])),
];
let summary = format_pipeline_summary(&steps);
- assert_snapshot!(summary.ansi_strip(), @"user:install, user:setup; user:build, user:lint");
+ assert_snapshot!(summary.ansi_strip(), @"install & setup, build & lint (user)");
}
#[test]
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_named.snap b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_named.snap
index 353f96618..76ce0888d 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_named.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_named.snap
@@ -53,4 +53,4 @@ exit_code: 0
◎ Removing feature worktree & branch in background (same commit as main, _)
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-merge: project:notify, project:deploy @ _REPO_
+◎ Running post-merge: notify & deploy (project) @ _REPO_
diff --git a/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap b/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap
index 2d33e2f17..bc1e5866a 100644
--- a/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap
+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap
@@ -83,4 +83,4 @@ test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fin
◎ Removing feature-auth worktree & branch in background (same commit as main, _)
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-merge: project:install @ _REPO_
+◎ Running post-merge: install (project) @ _REPO_
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap b/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap
index 9f5d4eca9..5101def9b 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap
@@ -51,4 +51,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: project:server @ _REPO_.feature
+◎ Running post-start: server (project) @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_mixed_user_pipeline_project_flat.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_mixed_user_pipeline_project_flat.snap
index d0106784e..2990979e1 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_mixed_user_pipeline_project_flat.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_mixed_user_pipeline_project_flat.snap
@@ -49,4 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: user; user:user_bg, project:proj @ _REPO_.feature
+◎ Running post-start: …, user_bg (user); proj (project) @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap
index 22a0c03d6..dd542433f 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap
@@ -49,4 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: project:task1, project:task2 @ _REPO_.feature
+◎ Running post-start: task1 & task2 (project) @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_pipeline_template_vars.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_pipeline_template_vars.snap
index 08efd6838..15caa5079 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_pipeline_template_vars.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_pipeline_template_vars.snap
@@ -49,4 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: project; project:check @ _REPO_.feature
+◎ Running post-start: …, check (project) @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_project_pipeline.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_project_pipeline.snap
index ad1454599..7f8cdfb33 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_project_pipeline.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_project_pipeline.snap
@@ -49,4 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: project; project:task1, project:task2 @ _REPO_.feature
+◎ Running post-start: …, task1 & task2 (project) @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap
index 976a9bb78..bb7d45878 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap
@@ -49,4 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: project:task1, project:task2, project:task3 @ _REPO_.feature
+◎ Running post-start: task1 & task2 & task3 (project) @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_verbose_output.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_verbose_output.snap
index e59f543c8..1e0c521c9 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_verbose_output.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_verbose_output.snap
@@ -81,4 +81,4 @@ exit_code: 0
  cwd = _REPO_.feature
  hook_type = post-start
  hook_name = setup
-◎ Running post-start: project:setup @ _REPO_.feature
+◎ Running post-start: setup (project) @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__shell_wrapper__unix_tests__readme_example_hooks_pre_start.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__unix_tests__readme_example_hooks_pre_start.snap
index 61d8e4fa8..2cc358029 100644
--- a/tests/snapshots/integration__integration_tests__shell_wrapper__unix_tests__readme_example_hooks_pre_start.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__unix_tests__readme_example_hooks_pre_start.snap
@@ -10,4 +10,4 @@ expression: "&output.combined"
Installed 24 packages in 1.2s
✓ Created branch feature-x from main and worktree @ _REPO_.feature-x
↳ To customize worktree locations, run wt config create
-◎ Running post-start: project:dev
+◎ Running post-start: dev (project)
diff --git a/tests/snapshots/integration__integration_tests__shell_wrapper__unix_tests__switch_with_hooks_zsh.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__unix_tests__switch_with_hooks_zsh.snap
index 3c5c142fc..8a0e27657 100644
--- a/tests/snapshots/integration__integration_tests__shell_wrapper__unix_tests__switch_with_hooks_zsh.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__unix_tests__switch_with_hooks_zsh.snap
@@ -11,4 +11,4 @@ Installing dependencies...
Building project...
✓ Created branch feature-hooks from main and worktree @ _REPO_.feature-hooks
↳ To customize worktree locations, run wt config create
-◎ Running post-start: project:server, project:watch
+◎ Running post-start: server & watch (project)
diff --git a/tests/snapshots/integration__integration_tests__step_alias__alias_pipeline_announcement.snap b/tests/snapshots/integration__integration_tests__step_alias__alias_pipeline_announcement.snap
index b753e9679..073a1ef21 100644
--- a/tests/snapshots/integration__integration_tests__step_alias__alias_pipeline_announcement.snap
+++ b/tests/snapshots/integration__integration_tests__step_alias__alias_pipeline_announcement.snap
@@ -46,6 +46,6 @@ exit_code: 0
INSTALL
----- stderr -----
-◎ Running alias deploy: install; build, lint
+◎ Running alias deploy: install, build & lint
build │ BUILD
lint  │ LINT
diff --git a/tests/snapshots/integration__integration_tests__step_prune__prune_hook_announcements_include_branch.snap b/tests/snapshots/integration__integration_tests__step_prune__prune_hook_announcements_include_branch.snap
index aae57262b..2779d2e9e 100644
--- a/tests/snapshots/integration__integration_tests__step_prune__prune_hook_announcements_include_branch.snap
+++ b/tests/snapshots/integration__integration_tests__step_prune__prune_hook_announcements_include_branch.snap
@@ -48,7 +48,7 @@ exit_code: 0
----- stderr -----
◎ Removing merged-x worktree & branch in background (same commit as main, _)
-◎ Running post-remove for merged-x: user:cleanup
+◎ Running post-remove for merged-x: cleanup (user)
◎ Removing merged-y worktree & branch in background (same commit as main, _)
-◎ Running post-remove for merged-y: user:cleanup
+◎ Running post-remove for merged-y: cleanup (user)
✓ Pruned 2 worktrees & branches
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__background_hook_env_var_visible.snap b/tests/snapshots/integration__integration_tests__user_hooks__background_hook_env_var_visible.snap
index 294e2ed38..ef94f3fa0 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__background_hook_env_var_visible.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__background_hook_env_var_visible.snap
@@ -51,4 +51,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: user:capture-bg @ _REPO_.feature
+◎ Running post-start: capture-bg (user) @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__combined_post_remove_and_post_switch.snap b/tests/snapshots/integration__integration_tests__user_hooks__combined_post_remove_and_post_switch.snap
index 9d27593b0..f40829a8a 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__combined_post_remove_and_post_switch.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__combined_post_remove_and_post_switch.snap
@@ -48,4 +48,4 @@ exit_code: 0
◎ Removing feature worktree & branch in background (--force-delete)
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-remove: user:cleanup; post-switch: user:notify @ _REPO_
+◎ Running post-remove: cleanup (user); post-switch: notify (user) @ _REPO_
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__combined_user_and_project_post_merge.snap b/tests/snapshots/integration__integration_tests__user_hooks__combined_user_and_project_post_merge.snap
index 86d964fd5..0392b3f7f 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__combined_user_and_project_post_merge.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__combined_user_and_project_post_merge.snap
@@ -52,4 +52,4 @@ exit_code: 0
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
○ Worktree preserved (--no-remove)
-◎ Running post-merge: user:sync, project:install @ _REPO_
+◎ Running post-merge: sync (user); install (project) @ _REPO_
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__hook_verbose_background_dedup.snap b/tests/snapshots/integration__integration_tests__user_hooks__hook_verbose_background_dedup.snap
index b5c6815b6..ecbdc2353 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__hook_verbose_background_dedup.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__hook_verbose_background_dedup.snap
@@ -85,4 +85,4 @@ exit_code: 0
  cwd = _REPO_.feature
  hook_type = post-start
  hook_name = (unset)
-◎ Running post-start: user, project @ _REPO_.feature
+◎ Running post-start: user; project @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__merge_auto_commit_combines_post_commit_post_remove_post_switch_post_merge.snap b/tests/snapshots/integration__integration_tests__user_hooks__merge_auto_commit_combines_post_commit_post_remove_post_switch_post_merge.snap
index ed7ce0238..eb9ddaf5a 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__merge_auto_commit_combines_post_commit_post_remove_post_switch_post_merge.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__merge_auto_commit_combines_post_commit_post_remove_post_switch_post_merge.snap
@@ -63,4 +63,4 @@ exit_code: 0
↳ Branch unmerged; to delete, run wt remove -D feature
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-commit: user:mark; post-remove: user:cleanup; post-switch: user:notify; post-merge: user:sync @ _REPO_
+◎ Running post-commit: mark (user); post-remove: cleanup (user); post-switch: notify (user); post-merge: sync (user) @ _REPO_
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__merge_combines_post_remove_post_switch_post_merge.snap b/tests/snapshots/integration__integration_tests__user_hooks__merge_combines_post_remove_post_switch_post_merge.snap
index c058f2d7a..1c9625d4b 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__merge_combines_post_remove_post_switch_post_merge.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__merge_combines_post_remove_post_switch_post_merge.snap
@@ -53,4 +53,4 @@ exit_code: 0
◎ Removing feature worktree & branch in background (same commit as main, _)
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-remove: user:cleanup; post-switch: user:notify; post-merge: user:sync @ _REPO_
+◎ Running post-remove: cleanup (user); post-switch: notify (user); post-merge: sync (user) @ _REPO_
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__merge_squash_combines_post_commit_post_remove_post_switch_post_merge.snap b/tests/snapshots/integration__integration_tests__user_hooks__merge_squash_combines_post_commit_post_remove_post_switch_post_merge.snap
index 582f6ae55..97ebf5117 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__merge_squash_combines_post_commit_post_remove_post_switch_post_merge.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__merge_squash_combines_post_commit_post_remove_post_switch_post_merge.snap
@@ -64,4 +64,4 @@ exit_code: 0
◎ Removing feature worktree & branch in background (same commit as main, _)
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-commit: user:mark; post-remove: user:cleanup; post-switch: user:notify; post-merge: user:sync @ _REPO_
+◎ Running post-commit: mark (user); post-remove: cleanup (user); post-switch: notify (user); post-merge: sync (user) @ _REPO_
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__multi_remove_hook_branch_context.snap b/tests/snapshots/integration__integration_tests__user_hooks__multi_remove_hook_branch_context.snap
index 24cf29c2c..c2d3d6f7c 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__multi_remove_hook_branch_context.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__multi_remove_hook_branch_context.snap
@@ -47,6 +47,6 @@ exit_code: 0
----- stderr -----
◎ Removing feature-a worktree & branch in background (--force-delete)
-◎ Running post-remove for feature-a: user:cleanup
+◎ Running post-remove for feature-a: cleanup (user)
◎ Removing feature-b worktree & branch in background (--force-delete)
-◎ Running post-remove for feature-b: user:cleanup
+◎ Running post-remove for feature-b: cleanup (user)
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__post_remove_runs_at_primary.snap b/tests/snapshots/integration__integration_tests__user_hooks__post_remove_runs_at_primary.snap
index 88368fa60..fd9cc82cf 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__post_remove_runs_at_primary.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__post_remove_runs_at_primary.snap
@@ -46,4 +46,4 @@ exit_code: 0
----- stderr -----
◎ Removing feature worktree & branch in background (--force-delete)
-◎ Running post-remove: user:cleanup @ _REPO_
+◎ Running post-remove: cleanup (user) @ _REPO_
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__standalone_hook_name_filtered_lazy_template.snap b/tests/snapshots/integration__integration_tests__user_hooks__standalone_hook_name_filtered_lazy_template.snap
index 46dccbfaf..2a324104c 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__standalone_hook_name_filtered_lazy_template.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__standalone_hook_name_filtered_lazy_template.snap
@@ -45,4 +45,4 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Running post-start: user:db
+◎ Running post-start: db (user)
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__standalone_hook_post_merge_combined_sources.snap b/tests/snapshots/integration__integration_tests__user_hooks__standalone_hook_post_merge_combined_sources.snap
index 2f469c629..91ac4c88f 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__standalone_hook_post_merge_combined_sources.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__standalone_hook_post_merge_combined_sources.snap
@@ -45,4 +45,4 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Running post-merge: user:notify, project
+◎ Running post-merge: notify (user); project
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_post_start.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_post_start.snap
index 1ff903a71..d8b791785 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_post_start.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_post_start.snap
@@ -49,4 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: user:bg, project @ _REPO_.feature
+◎ Running post-start: bg (user); project @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_unnamed_post_start.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_unnamed_post_start.snap
index 360e661c6..3c5c34931 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_unnamed_post_start.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_unnamed_post_start.snap
@@ -49,4 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: user, project @ _REPO_.feature
+◎ Running post-start: user; project @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_commit_executes.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_commit_executes.snap
index 4db1aafd9..0dbb79dc9 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_commit_executes.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_commit_executes.snap
@@ -50,4 +50,4 @@ exit_code: 0
◎ Generating commit message and committing changes... (1 file, +1)
  feat: test commit
✓ Committed changes @ [HASH]
-◎ Running post-commit: user:notify
+◎ Running post-commit: notify (user)
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_commit_failure.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_commit_failure.snap
index 9b3826deb..d8609c6fe 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_commit_failure.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_commit_failure.snap
@@ -50,4 +50,4 @@ exit_code: 0
◎ Generating commit message and committing changes... (1 file, +1)
  feat: test commit
✓ Committed changes @ [HASH]
-◎ Running post-commit: user:failing
+◎ Running post-commit: failing (user)
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_merge_executes.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_merge_executes.snap
index c154b86f9..f349dce4b 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_merge_executes.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_merge_executes.snap
@@ -52,4 +52,4 @@ exit_code: 0
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
○ Worktree preserved (--no-remove)
-◎ Running post-merge: user:notify @ _REPO_
+◎ Running post-merge: notify (user) @ _REPO_
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_remove_executes.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_remove_executes.snap
index b255ffb2c..8f9cf47de 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_remove_executes.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_remove_executes.snap
@@ -46,4 +46,4 @@ exit_code: 0
----- stderr -----
◎ Removing feature worktree & branch in background (--force-delete)
-◎ Running post-remove: user:cleanup
+◎ Running post-remove: cleanup (user)
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_executes.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_executes.snap
index e682574bf..3bb5d2dd5 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_executes.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_executes.snap
@@ -49,4 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: user:bg @ _REPO_.feature
+◎ Running post-start: bg (user) @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_concurrent_all.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_concurrent_all.snap
index b6af9045e..2d6f32f54 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_concurrent_all.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_concurrent_all.snap
@@ -49,4 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: user:a, user:b @ _REPO_.feature
+◎ Running post-start: a & b (user) @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_concurrent_failure.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_concurrent_failure.snap
index ac1479c2d..34333d219 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_concurrent_failure.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_concurrent_failure.snap
@@ -49,4 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: user:fail, user:ok; user @ _REPO_.feature
+◎ Running post-start: fail & ok, … (user) @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_failure.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_failure.snap
index 5a7b150b6..1d8cc677e 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_failure.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_failure.snap
@@ -49,4 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: user; user:bg @ _REPO_.feature
+◎ Running post-start: …, bg (user) @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_hook_name_per_step.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_hook_name_per_step.snap
index 6d5a7b681..9d4bb7454 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_hook_name_per_step.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_hook_name_per_step.snap
@@ -49,4 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: user:step_one; user:step_two @ _REPO_.feature
+◎ Running post-start: step_one, step_two (user) @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_lazy_vars_bg.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_lazy_vars_bg.snap
index 270646637..75902019f 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_lazy_vars_bg.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_lazy_vars_bg.snap
@@ -49,4 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: user; user:db @ _REPO_.feature
+◎ Running post-start: …, db (user) @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_ordering.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_ordering.snap
index 5a7b150b6..1d8cc677e 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_ordering.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_pipeline_ordering.snap
@@ -49,4 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: user; user:bg @ _REPO_.feature
+◎ Running post-start: …, bg (user) @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_switch_pipeline_via_create.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_switch_pipeline_via_create.snap
index b18fb48ae..870397b82 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_switch_pipeline_via_create.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_switch_pipeline_via_create.snap
@@ -49,4 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-switch: user; user:check @ _REPO_.feature
+◎ Running post-switch: …, check (user) @ _REPO_.feature