Skip to content

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

Name the template owner in the -v variables block (#3495)

Maximilian Roos85c9241cb18b
diff --git a/docs/content/step.md b/docs/content/step.md
index 8f05a6078..e7629361d 100644
--- a/docs/content/step.md
+++ b/docs/content/step.md
@@ -551,7 +551,7 @@ feature_auth_oauth2_a1b
List the available template variables with `-v` (alongside the expansion, on stderr):
{% terminal(cmd="wt step eval -v '__WT_OPEN__ branch __WT_CLOSE__'") %}
-○ Available template variables
+○ eval template variables:
branch = feature/auth-oauth2
worktree_path = /home/user/projects/myapp-feature-auth-oauth2
○ eval source
diff --git a/plugins/worktrunk/skills/worktrunk/reference/step.md b/plugins/worktrunk/skills/worktrunk/reference/step.md
index 85d72b08e..82fa91d43 100644
--- a/plugins/worktrunk/skills/worktrunk/reference/step.md
+++ b/plugins/worktrunk/skills/worktrunk/reference/step.md
@@ -568,7 +568,7 @@ List the available template variables with `-v` (alongside the expansion, on std
```bash
$ wt step eval -v '{{ branch }}'
-○ Available template variables
+○ eval template variables:
branch = feature/auth-oauth2
worktree_path = /home/user/projects/myapp-feature-auth-oauth2
○ eval source
diff --git a/skills/worktrunk/reference/step.md b/skills/worktrunk/reference/step.md
index 85d72b08e..82fa91d43 100644
--- a/skills/worktrunk/reference/step.md
+++ b/skills/worktrunk/reference/step.md
@@ -568,7 +568,7 @@ List the available template variables with `-v` (alongside the expansion, on std
```bash
$ wt step eval -v '{{ branch }}'
-○ Available template variables
+○ eval template variables:
branch = feature/auth-oauth2
worktree_path = /home/user/projects/myapp-feature-auth-oauth2
○ eval source
diff --git a/src/cli/step.rs b/src/cli/step.rs
index 084cb8db2..a4d9d67e5 100644
--- a/src/cli/step.rs
+++ b/src/cli/step.rs
@@ -439,7 +439,7 @@ List the available template variables with `-v` (alongside the expansion, on std
```console
$ wt step eval -v '{{ branch }}'
-○ Available template variables
+○ eval template variables:
branch = feature/auth-oauth2
worktree_path = /home/user/projects/myapp-feature-auth-oauth2
○ eval source
diff --git a/src/commands/alias.rs b/src/commands/alias.rs
index cc2dcd350..a321ff8c0 100644
--- a/src/commands/alias.rs
+++ b/src/commands/alias.rs
@@ -618,7 +618,10 @@ fn run_alias(
if verbosity() >= 1 {
let vars = format_alias_variables(&context_map, Some(&referenced));
- eprintln!("{}", info_message("template variables:"));
+ eprintln!(
+ "{}",
+ info_message(cformat!("<bold>{}</> template variables:", opts.name))
+ );
eprintln!("{}", format_with_gutter(&vars, None));
}
diff --git a/src/commands/command_executor.rs b/src/commands/command_executor.rs
index 7bf2b21a2..885fc97f1 100644
--- a/src/commands/command_executor.rs
+++ b/src/commands/command_executor.rs
@@ -628,7 +628,10 @@ fn announce_command(cmd: &PreparedCommand, kind: &PipelineKind, command_str: &st
};
if verbosity() >= 1 {
let vars = format_hook_variables(*hook_type, &cmd.context);
- eprintln!("{}", info_message("template variables:"));
+ eprintln!(
+ "{}",
+ info_message(cformat!("<bold>{hook_type}</> template variables:"))
+ );
eprintln!("{}", format_with_gutter(&vars, None));
}
eprintln!("{}", progress_message(message));
diff --git a/src/commands/eval.rs b/src/commands/eval.rs
index 277ec7f88..1fe01fb82 100644
--- a/src/commands/eval.rs
+++ b/src/commands/eval.rs
@@ -51,7 +51,10 @@ pub fn step_eval(template: &str, format: SwitchFormat) -> anyhow::Result<()> {
})
.collect::<Vec<_>>()
.join("\n");
- eprintln!("{}", info_message("Available template variables"));
+ eprintln!(
+ "{}",
+ info_message(cformat!("<bold>{EVAL_NAME}</> template variables:"))
+ );
eprintln!("{}", format_with_gutter(&listing, None));
}
diff --git a/src/commands/hooks.rs b/src/commands/hooks.rs
index 9b9d9078c..39da3cfbd 100644
--- a/src/commands/hooks.rs
+++ b/src/commands/hooks.rs
@@ -465,7 +465,10 @@ fn print_background_variable_table(pipelines: &[PendingPipeline], hook_type: Hoo
PreparedStep::Single(cmd) => cmd,
PreparedStep::Concurrent(cmds) => &cmds[0],
};
- eprintln!("{}", info_message("template variables:"));
+ eprintln!(
+ "{}",
+ info_message(cformat!("<bold>{hook_type}</> template variables:"))
+ );
eprintln!(
"{}",
format_with_gutter(&format_hook_variables(hook_type, &cmd.context), None)
diff --git a/tests/snapshots/integration__integration_tests__eval__eval_format_json_verbose.snap b/tests/snapshots/integration__integration_tests__eval__eval_format_json_verbose.snap
index e58a3161f..18a1cf9bf 100644
--- a/tests/snapshots/integration__integration_tests__eval__eval_format_json_verbose.snap
+++ b/tests/snapshots/integration__integration_tests__eval__eval_format_json_verbose.snap
@@ -10,6 +10,7 @@ info:
- "{{ branch | hash_port }}"
env:
APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
CLICOLOR_FORCE: "1"
COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
@@ -38,6 +39,7 @@ info:
WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
@@ -54,7 +56,7 @@ exit_code: 0
}
----- stderr -----
-○ Available template variables
+○ eval template variables:
  branch = main
  commit = 05a4a45d0b981dad5c27db59dca482836d59f89e
  cwd = _REPO_
diff --git a/tests/snapshots/integration__integration_tests__eval__eval_verbose.snap b/tests/snapshots/integration__integration_tests__eval__eval_verbose.snap
index 6331f4e6e..031080134 100644
--- a/tests/snapshots/integration__integration_tests__eval__eval_verbose.snap
+++ b/tests/snapshots/integration__integration_tests__eval__eval_verbose.snap
@@ -9,6 +9,7 @@ info:
- "{{ branch | hash_port }}"
env:
APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
CLICOLOR_FORCE: "1"
COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
@@ -37,6 +38,7 @@ info:
WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
@@ -49,7 +51,7 @@ exit_code: 0
12107
----- stderr -----
-○ Available template variables
+○ eval template variables:
  branch = main
  commit = 05a4a45d0b981dad5c27db59dca482836d59f89e
  cwd = _REPO_
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 43d4a6fcc..ed0d68051 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
@@ -9,6 +9,7 @@ info:
- feature
env:
APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
CLICOLOR_FORCE: "1"
COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
@@ -37,6 +38,7 @@ info:
WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
@@ -56,7 +58,7 @@ 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
-○ template variables:
+○ post-start template variables:
  branch = feature
  worktree_path = _REPO_.feature
  worktree_name = repo.feature
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_verbose_template_expansion.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_verbose_template_expansion.snap
index 801da48b3..f4626fe73 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_verbose_template_expansion.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_verbose_template_expansion.snap
@@ -9,6 +9,7 @@ info:
- verbose-hooks
env:
APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
CLICOLOR_FORCE: "1"
COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
@@ -37,6 +38,7 @@ info:
WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
@@ -56,7 +58,7 @@ exit_code: 0
  echo 'Setting up {{ branch | sanitize }} in {{ worktree_path }}'
○ project:setup result
  echo 'Setting up verbose-hooks in _REPO_.verbose-hooks'
-○ template variables:
+○ pre-start template variables:
  branch = verbose-hooks
  worktree_path = _REPO_.verbose-hooks
  worktree_name = repo.verbose-hooks
diff --git a/tests/snapshots/integration__integration_tests__step_alias__alias_verbose_args_shell_escaped.snap b/tests/snapshots/integration__integration_tests__step_alias__alias_verbose_args_shell_escaped.snap
index 4bd1f29c2..3c2c86673 100644
--- a/tests/snapshots/integration__integration_tests__step_alias__alias_verbose_args_shell_escaped.snap
+++ b/tests/snapshots/integration__integration_tests__step_alias__alias_verbose_args_shell_escaped.snap
@@ -9,6 +9,7 @@ info:
- bar baz
env:
APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
CLICOLOR_FORCE: "1"
COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
@@ -37,6 +38,7 @@ info:
WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
@@ -49,7 +51,7 @@ exit_code: 0
hello foo bar baz
----- stderr -----
-○ template variables:
+○ greet template variables:
  branch = feature
  worktree_path = _REPO_.feature
  worktree_name = repo.feature
diff --git a/tests/snapshots/integration__integration_tests__step_alias__alias_verbose_variable_table.snap b/tests/snapshots/integration__integration_tests__step_alias__alias_verbose_variable_table.snap
index 133928cef..8f1787f5d 100644
--- a/tests/snapshots/integration__integration_tests__step_alias__alias_verbose_variable_table.snap
+++ b/tests/snapshots/integration__integration_tests__step_alias__alias_verbose_variable_table.snap
@@ -8,6 +8,7 @@ info:
- world
env:
APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
CLICOLOR_FORCE: "1"
COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
@@ -36,6 +37,7 @@ info:
WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
@@ -48,7 +50,7 @@ exit_code: 0
hello world
----- stderr -----
-○ template variables:
+○ greet template variables:
  branch = feature
  worktree_path = _REPO_.feature
  worktree_name = repo.feature
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__combined_post_remove_and_post_switch_verbose.snap b/tests/snapshots/integration__integration_tests__user_hooks__combined_post_remove_and_post_switch_verbose.snap
index cb272a0f5..36e8cc153 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__combined_post_remove_and_post_switch_verbose.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__combined_post_remove_and_post_switch_verbose.snap
@@ -38,6 +38,7 @@ info:
WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
@@ -52,7 +53,7 @@ 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
-○ template variables:
+○ post-remove template variables:
  branch = feature
  worktree_path = _REPO_.feature
  worktree_name = repo.feature
@@ -71,7 +72,7 @@ exit_code: 0
  cwd = _REPO_
  hook_type = post-remove
  hook_name = cleanup
-○ template variables:
+○ post-switch template variables:
  branch = main
  worktree_path = _REPO_
  worktree_name = 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 848d57dfd..e55a5cc95 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
@@ -9,6 +9,7 @@ info:
- feature
env:
APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
CLICOLOR_FORCE: "1"
COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
@@ -37,6 +38,7 @@ info:
WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
@@ -56,7 +58,7 @@ 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
-○ template variables:
+○ post-start template variables:
  branch = feature
  worktree_path = _REPO_.feature
  worktree_name = repo.feature
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__hook_verbose_variable_table.snap b/tests/snapshots/integration__integration_tests__user_hooks__hook_verbose_variable_table.snap
index a92b95513..398447a0b 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__hook_verbose_variable_table.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__hook_verbose_variable_table.snap
@@ -37,6 +37,7 @@ info:
WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
@@ -52,7 +53,7 @@ exit_code: 0
  true
○ user:noop result
  true
-○ template variables:
+○ pre-switch template variables:
  branch = feature
  worktree_path = _REPO_.feature
  worktree_name = repo.feature