Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Rename template variables for clarity with deprecation warnings (#369)
Maximilian Roosfeff9d22ca82
diff --git a/.claude-plugin/skills/worktrunk/reference/hook-types-reference.md b/.claude-plugin/skills/worktrunk/reference/hook-types-reference.mdindex 6ae6b8b57..3c20b2872 100644--- a/.claude-plugin/skills/worktrunk/reference/hook-types-reference.md+++ b/.claude-plugin/skills/worktrunk/reference/hook-types-reference.md@@ -14,7 +14,7 @@ Detailed behavior and use cases for all seven Worktrunk hook types.| `post-merge` | After successful merge | Yes | No | Basic + Merge | Sequential || `pre-remove` | Before worktree removed | Yes | Yes | Basic | Sequential |-**Basic variables**: `{{ repo }}`, `{{ branch }}`, `{{ worktree }}`, `{{ worktree_name }}`, `{{ repo_root }}`, `{{ default_branch }}`, `{{ commit }}`, `{{ short_commit }}`, `{{ remote }}`, `{{ remote_url }}`, `{{ upstream }}`+**Basic variables**: `{{ repo }}`, `{{ repo_path }}`, `{{ branch }}`, `{{ worktree_name }}`, `{{ worktree_path }}`, `{{ default_branch }}`, `{{ commit }}`, `{{ short_commit }}`, `{{ remote }}`, `{{ remote_url }}`, `{{ upstream }}`**Merge variables**: Basic + `{{ target }}`**Filters**: `{{ branch | sanitize }}` (replace `/` `\` with `-`), `{{ branch | hash_port }}` (port 10000-19999)@@ -252,10 +252,10 @@ post-create = "echo 'Working on {{ branch }} in {{ repo }}'"Available:- `{{ repo }}` - Repository name (e.g., "my-project")+- `{{ repo_path }}` - Absolute path to repository (e.g., "/path/to/my-project")- `{{ branch }}` - Branch name (e.g., "feature-auth")-- `{{ worktree }}` - Absolute path to worktree- `{{ worktree_name }}` - Worktree directory name (e.g., "my-project.feature-auth")-- `{{ repo_root }}` - Absolute path to repository root+- `{{ worktree_path }}` - Absolute path to worktree (e.g., "/path/to/my-project.feature-auth")- `{{ default_branch }}` - Default branch name (e.g., "main")- `{{ commit }}` - Full HEAD commit SHA- `{{ short_commit }}` - Short HEAD commit SHA (7 chars)diff --git a/.claude-plugin/skills/worktrunk/reference/project-config.md b/.claude-plugin/skills/worktrunk/reference/project-config.mdindex 5657141e7..1bc2e9c36 100644--- a/.claude-plugin/skills/worktrunk/reference/project-config.md+++ b/.claude-plugin/skills/worktrunk/reference/project-config.md@@ -188,10 +188,10 @@ All hooks support template variables for dynamic behavior.Available in all hook types:- `{{ repo }}` - Repository name (e.g., "my-project")+- `{{ repo_path }}` - Absolute path to repository (e.g., "/path/to/my-project")- `{{ branch }}` - Raw branch name (e.g., "feature/auth")-- `{{ worktree }}` - Absolute path to worktree- `{{ worktree_name }}` - Worktree directory name (e.g., "my-project.feature-auth")-- `{{ repo_root }}` - Absolute path to repository root+- `{{ worktree_path }}` - Absolute path to worktree (e.g., "/path/to/my-project.feature-auth")- `{{ default_branch }}` - Default branch name (e.g., "main")- `{{ commit }}` - Full HEAD commit SHA- `{{ short_commit }}` - Short HEAD commit SHA (7 chars)@@ -208,7 +208,7 @@ Example:```toml[post-start]dev = "npm run dev --port {{ branch | hash_port }}"-cache = "ln -sf {{ repo_root }}/node_modules.{{ branch | sanitize }} node_modules"+cache = "ln -sf {{ repo_path }}/node_modules.{{ branch | sanitize }} node_modules"```<example type="basic-variables">diff --git a/Cargo.toml b/Cargo.tomlindex f1b14a1b3..5e7e85356 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -111,6 +111,7 @@ dunce = "1.0"termimad = "0.34.1"rayon-join-macro = "0.1.1"urlencoding = "2.1"+regex = "1.12"[target.'cfg(unix)'.dependencies]skim = "0.20"diff --git a/dev/wt.example.toml b/dev/wt.example.tomlindex 43e481f6c..981df011e 100644--- a/dev/wt.example.toml+++ b/dev/wt.example.toml@@ -6,10 +6,10 @@# developers working on the project.# Available template variables (all hooks):-# {{ repo }} - Repository name (e.g., "my-project")-# {{ branch }} - Raw branch name (e.g., "feature/foo")-# {{ worktree }} - Absolute path to the worktree-# {{ repo_root }} - Absolute path to the repository root+# {{ repo }} - Repository name (e.g., "my-project")+# {{ repo_path }} - Absolute path to repository (e.g., "/path/to/my-project")+# {{ branch }} - Raw branch name (e.g., "feature/foo")+# {{ worktree_path }} - Absolute path to worktree (e.g., "/path/to/my-project.feature-foo")## Merge-related hooks also support:# {{ target }} - Target branch for the merge (e.g., "main" default branch)diff --git a/docs/content/config.md b/docs/content/config.mdindex 55d620050..4e6e328d9 100644--- a/docs/content/config.md+++ b/docs/content/config.md@@ -489,10 +489,10 @@ With `--project`, creates `.config/wt.toml` in the current repository:# developers working on the project.# Available template variables (all hooks):-# {{ repo }} - Repository name (e.g., "my-project")-# {{ branch }} - Raw branch name (e.g., "feature/foo")-# {{ worktree }} - Absolute path to the worktree-# {{ repo_root }} - Absolute path to the repository root+# {{ repo }} - Repository name (e.g., "my-project")+# {{ repo_path }} - Absolute path to repository (e.g., "/path/to/my-project")+# {{ branch }} - Raw branch name (e.g., "feature/foo")+# {{ worktree_path }} - Absolute path to worktree (e.g., "/path/to/my-project.feature-foo")## Merge-related hooks also support:# {{ target }} - Target branch for the merge (e.g., "main" default branch)diff --git a/docs/content/hook.md b/docs/content/hook.mdindex b10c37ee0..4ddf48181 100644--- a/docs/content/hook.md+++ b/docs/content/hook.md@@ -140,11 +140,12 @@ Hooks can use template variables that expand at runtime:| Variable | Example | Description ||----------|---------|-------------|-| `{{ repo }}` | my-project | Repository name |+| `{{ repo }}` | my-project | Repository directory name |+| `{{ repo_path }}` | /path/to/my-project | Absolute path to repository root || `{{ branch }}` | feature-foo | Branch name |-| `{{ worktree }}` | /path/to/worktree | Absolute worktree path || `{{ worktree_name }}` | my-project.feature-foo | Worktree directory name |-| `{{ repo_root }}` | /path/to/main | Repository root path |+| `{{ worktree_path }}` | /path/to/my-project.feature-foo | Absolute worktree path |+| `{{ main_worktree_path }}` | /path/to/my-project | Default branch worktree || `{{ default_branch }}` | main | Default branch name || `{{ commit }}` | a1b2c3d4e5f6... | Full HEAD commit SHA || `{{ short_commit }}` | a1b2c3d | Short HEAD commit SHA |@@ -153,6 +154,10 @@ Hooks can use template variables that expand at runtime:| `{{ upstream }}` | origin/feature | Upstream tracking branch || `{{ target }}` | main | Target branch (merge hooks only) |+See [Designing effective hooks](#designing-effective-hooks) for `main_worktree_path` patterns.++**Deprecated:** `repo_root` (use `repo_path`), `worktree` (use `worktree_path`), `main_worktree` (use `repo`). These still work but emit warnings.+### FiltersTemplates support Jinja2 filters for transforming values:@@ -234,11 +239,11 @@ Cross-platform pattern that auto-detects and falls back gracefully:[post-create]deps = """if cp -c /dev/null /dev/null 2>/dev/null; then- cp -c -r {{ repo_root }}/node_modules .+ cp -c -r {{ main_worktree_path }}/node_modules .elif cp --reflink=auto /dev/null /dev/null 2>/dev/null; then- cp --reflink=auto -r {{ repo_root }}/node_modules .+ cp --reflink=auto -r {{ main_worktree_path }}/node_modules .else- cp -r {{ repo_root }}/node_modules .+ cp -r {{ main_worktree_path }}/node_modules .fi"""```@@ -396,10 +401,10 @@ The `target/` directory is huge (often 1-10GB) and benefits most from CoW. Workt```toml[post-start]deps = """-[ -d {{ repo_root }}/target/debug/deps ] && [ ! -e target ] &&+[ -d {{ main_worktree_path }}/target/debug/deps ] && [ ! -e target ] &&mkdir -p target/debug/deps &&-cp -c {{ repo_root }}/target/debug/deps/*.rlib {{ repo_root }}/target/debug/deps/*.rmeta target/debug/deps/ &&-cp -cR {{ repo_root }}/target/debug/.fingerprint {{ repo_root }}/target/debug/build target/debug/+cp -c {{ main_worktree_path }}/target/debug/deps/*.rlib {{ main_worktree_path }}/target/debug/deps/*.rmeta target/debug/deps/ &&+cp -cR {{ main_worktree_path }}/target/debug/.fingerprint {{ main_worktree_path }}/target/debug/build target/debug/"""```@@ -427,14 +432,14 @@ venv = "python -m venv .venv && .venv/bin/pip install -r requirements.txt"```toml[post-create]-deps = "cp -c -r {{ repo_root }}/node_modules . 2>/dev/null || npm ci"+deps = "cp -c -r {{ main_worktree_path }}/node_modules . 2>/dev/null || npm ci"```If the project has no native dependencies, symlinks are even faster:```toml[post-create]-deps = "ln -sf {{ repo_root }}/node_modules ."+deps = "ln -sf {{ main_worktree_path }}/node_modules ."```### Hook flow patternsdiff --git a/docs/content/step.md b/docs/content/step.mdindex e9bcdc8aa..c20f0a6c9 100644--- a/docs/content/step.md+++ b/docs/content/step.md@@ -84,10 +84,11 @@ All variables are shell-escaped:|----------|-------------|| `{{ branch }}` | Branch name (raw, e.g., `feature/foo`) || `{{ branch \| sanitize }}` | Branch name with `/` and `\` replaced by `-` |-| `{{ worktree }}` | Absolute path to the worktree |+| `{{ repo }}` | Repository directory name |+| `{{ repo_path }}` | Absolute path to repository root || `{{ worktree_name }}` | Worktree directory name |-| `{{ repo }}` | Repository name |-| `{{ repo_root }}` | Absolute path to the main repository root |+| `{{ worktree_path }}` | Absolute path to current worktree |+| `{{ main_worktree_path }}` | Default branch worktree path || `{{ commit }}` | Current HEAD commit SHA (full) || `{{ short_commit }}` | Current HEAD commit SHA (7 chars) || `{{ default_branch }}` | Default branch name (e.g., "main") |@@ -95,6 +96,8 @@ All variables are shell-escaped:| `{{ remote_url }}` | Primary remote URL || `{{ upstream }}` | Upstream tracking branch, if configured |+**Deprecated:** `repo_root` (use `repo_path`), `worktree` (use `worktree_path`), `main_worktree` (use `repo`).+### ExamplesCheck status across all worktrees:diff --git a/src/cli.rs b/src/cli.rsindex 6b67597ed..f8f8cd9f1 100644--- a/src/cli.rs+++ b/src/cli.rs@@ -951,10 +951,11 @@ All variables are shell-escaped:|----------|-------------|| `{{ branch }}` | Branch name (raw, e.g., `feature/foo`) || `{{ branch \| sanitize }}` | Branch name with `/` and `\` replaced by `-` |-| `{{ worktree }}` | Absolute path to the worktree |+| `{{ repo }}` | Repository directory name |+| `{{ repo_path }}` | Absolute path to repository root || `{{ worktree_name }}` | Worktree directory name |-| `{{ repo }}` | Repository name |-| `{{ repo_root }}` | Absolute path to the main repository root |+| `{{ worktree_path }}` | Absolute path to current worktree |+| `{{ main_worktree_path }}` | Default branch worktree path || `{{ commit }}` | Current HEAD commit SHA (full) || `{{ short_commit }}` | Current HEAD commit SHA (7 chars) || `{{ default_branch }}` | Default branch name (e.g., "main") |@@ -962,6 +963,8 @@ All variables are shell-escaped:| `{{ remote_url }}` | Primary remote URL || `{{ upstream }}` | Upstream tracking branch, if configured |+**Deprecated:** `repo_root` (use `repo_path`), `worktree` (use `worktree_path`), `main_worktree` (use `repo`).+## ExamplesCheck status across all worktrees:@@ -1614,11 +1617,12 @@ Hooks can use template variables that expand at runtime:| Variable | Example | Description ||----------|---------|-------------|-| `{{ repo }}` | my-project | Repository name |+| `{{ repo }}` | my-project | Repository directory name |+| `{{ repo_path }}` | /path/to/my-project | Absolute path to repository root || `{{ branch }}` | feature-foo | Branch name |-| `{{ worktree }}` | /path/to/worktree | Absolute worktree path || `{{ worktree_name }}` | my-project.feature-foo | Worktree directory name |-| `{{ repo_root }}` | /path/to/main | Repository root path |+| `{{ worktree_path }}` | /path/to/my-project.feature-foo | Absolute worktree path |+| `{{ main_worktree_path }}` | /path/to/my-project | Default branch worktree || `{{ default_branch }}` | main | Default branch name || `{{ commit }}` | a1b2c3d4e5f6... | Full HEAD commit SHA || `{{ short_commit }}` | a1b2c3d | Short HEAD commit SHA |@@ -1627,6 +1631,10 @@ Hooks can use template variables that expand at runtime:| `{{ upstream }}` | origin/feature | Upstream tracking branch || `{{ target }}` | main | Target branch (merge hooks only) |+See [Designing effective hooks](#designing-effective-hooks) for `main_worktree_path` patterns.++**Deprecated:** `repo_root` (use `repo_path`), `worktree` (use `worktree_path`), `main_worktree` (use `repo`). These still work but emit warnings.+### FiltersTemplates support Jinja2 filters for transforming values:@@ -1708,11 +1716,11 @@ Cross-platform pattern that auto-detects and falls back gracefully:[post-create]deps = """if cp -c /dev/null /dev/null 2>/dev/null; then- cp -c -r {{ repo_root }}/node_modules .+ cp -c -r {{ main_worktree_path }}/node_modules .elif cp --reflink=auto /dev/null /dev/null 2>/dev/null; then- cp --reflink=auto -r {{ repo_root }}/node_modules .+ cp --reflink=auto -r {{ main_worktree_path }}/node_modules .else- cp -r {{ repo_root }}/node_modules .+ cp -r {{ main_worktree_path }}/node_modules .fi"""```@@ -1870,10 +1878,10 @@ The `target/` directory is huge (often 1-10GB) and benefits most from CoW. Workt```toml[post-start]deps = """-[ -d {{ repo_root }}/target/debug/deps ] && [ ! -e target ] &&+[ -d {{ main_worktree_path }}/target/debug/deps ] && [ ! -e target ] &&mkdir -p target/debug/deps &&-cp -c {{ repo_root }}/target/debug/deps/*.rlib {{ repo_root }}/target/debug/deps/*.rmeta target/debug/deps/ &&-cp -cR {{ repo_root }}/target/debug/.fingerprint {{ repo_root }}/target/debug/build target/debug/+cp -c {{ main_worktree_path }}/target/debug/deps/*.rlib {{ main_worktree_path }}/target/debug/deps/*.rmeta target/debug/deps/ &&+cp -cR {{ main_worktree_path }}/target/debug/.fingerprint {{ main_worktree_path }}/target/debug/build target/debug/"""```@@ -1901,14 +1909,14 @@ venv = "python -m venv .venv && .venv/bin/pip install -r requirements.txt"```toml[post-create]-deps = "cp -c -r {{ repo_root }}/node_modules . 2>/dev/null || npm ci"+deps = "cp -c -r {{ main_worktree_path }}/node_modules . 2>/dev/null || npm ci"```If the project has no native dependencies, symlinks are even faster:```toml[post-create]-deps = "ln -sf {{ repo_root }}/node_modules ."+deps = "ln -sf {{ main_worktree_path }}/node_modules ."```### Hook flow patternsdiff --git a/src/commands/command_executor.rs b/src/commands/command_executor.rsindex 8dacfeb1d..02ca51d4c 100644--- a/src/commands/command_executor.rs+++ b/src/commands/command_executor.rs@@ -71,19 +71,36 @@ pub fn build_hook_context(.and_then(|n| n.to_str()).unwrap_or("unknown");+ let repo_path = to_posix_path(&repo_root.to_string_lossy());+let mut map = HashMap::new();map.insert("repo".into(), repo_name.into());- map.insert("main_worktree".into(), repo_name.into()); // Alias for repomap.insert("branch".into(), ctx.branch_or_head().into());- map.insert("worktree".into(), worktree);map.insert("worktree_name".into(), worktree_name.into());- map.insert(- "repo_root".into(),- to_posix_path(&repo_root.to_string_lossy()),- );+ // Canonical path variables+ map.insert("repo_path".into(), repo_path.clone());+ map.insert("worktree_path".into(), worktree.clone());++ // TODO: Add `base` (branch) and `base_worktree_path` for post-create/post-switch hooks.+ // Requires tracking source worktree before switch and passing via extra_vars.++ // Deprecated aliases (kept for backward compatibility)+ map.insert("main_worktree".into(), repo_name.into());+ map.insert("repo_root".into(), repo_path);+ map.insert("worktree".into(), worktree);++ // Default branch and main worktree pathif let Ok(default_branch) = ctx.repo.default_branch() {- map.insert("default_branch".into(), default_branch);+ map.insert("default_branch".into(), default_branch.clone());++ // main_worktree_path: path to the worktree on the default branch+ if let Ok(Some(path)) = ctx.repo.worktree_for_branch(&default_branch) {+ map.insert(+ "main_worktree_path".into(),+ to_posix_path(&path.to_string_lossy()),+ );+ }}if let Ok(commit) = ctx.repo.run_command(&["rev-parse", "HEAD"]) {diff --git a/src/commands/config.rs b/src/commands/config.rsindex 58aaf3182..d9e07d580 100644--- a/src/commands/config.rs+++ b/src/commands/config.rs@@ -285,7 +285,8 @@ fn render_user_config(out: &mut String) -> anyhow::Result<()> {)))?;writeln!(out)?;- let default_config = "# Default configuration:\nworktree-path = \"../{{ main_worktree }}.{{ branch | sanitize }}\"";+ let default_config =+ "# Default configuration:\nworktree-path = \"../{{ repo }}.{{ branch | sanitize }}\"";write!(out, "{}", format_toml(default_config))?;return Ok(());}diff --git a/src/config/deprecation.rs b/src/config/deprecation.rsnew file mode 100644index 000000000..62f070996--- /dev/null+++ b/src/config/deprecation.rs@@ -0,0 +1,382 @@+//! Deprecated template variable detection and migration+//!+//! Scans config file content for deprecated template variables and generates+//! a migration file with replacements.++use crate::styling::{eprintln, hint_message, warning_message};+use color_print::cformat;+use minijinja::Environment;+use shell_escape::escape;+use std::borrow::Cow;+use std::collections::HashSet;+use std::io::Write;+use std::path::{Path, PathBuf};+use std::sync::Mutex;++/// Tracks which config paths have already shown deprecation warnings this process.+/// Prevents repeated warnings when config is loaded multiple times.+static WARNED_PATHS: Mutex<Option<HashSet<PathBuf>>> = Mutex::new(None);++/// Mapping from deprecated variable name to its replacement+const DEPRECATED_VARS: &[(&str, &str)] = &[+ ("repo_root", "repo_path"),+ ("worktree", "worktree_path"),+ ("main_worktree", "repo"),+];++/// Find all deprecated variables used in the content+///+/// Parses TOML to extract string values, then uses minijinja to detect+/// which template variables are referenced.+///+/// Returns a deduplicated list of (deprecated_name, replacement_name) pairs+pub fn find_deprecated_vars(content: &str) -> Vec<(&'static str, &'static str)> {+ // Parse TOML and extract all string values that might contain templates+ let template_strings = extract_template_strings(content);++ // Collect all variables used across all templates+ let mut used_vars = HashSet::new();+ let env = Environment::new();++ for template_str in template_strings {+ if let Ok(template) = env.template_from_str(&template_str) {+ used_vars.extend(template.undeclared_variables(false));+ }+ }++ // Check which deprecated variables are used+ DEPRECATED_VARS+ .iter()+ .filter(|(old, _)| used_vars.contains(*old))+ .copied()+ .collect()+}++/// Extract all string values from TOML content that might contain templates+fn extract_template_strings(content: &str) -> Vec<String> {+ let Ok(table) = content.parse::<toml::Table>() else {+ return vec![];+ };++ let mut strings = Vec::new();+ collect_strings_from_value(&toml::Value::Table(table), &mut strings);+ strings+}++/// Recursively collect all string values from a TOML value+fn collect_strings_from_value(value: &toml::Value, strings: &mut Vec<String>) {+ match value {+ toml::Value::String(s) => strings.push(s.clone()),+ toml::Value::Array(arr) => {+ for v in arr {+ collect_strings_from_value(v, strings);+ }+ }+ toml::Value::Table(table) => {+ for v in table.values() {+ collect_strings_from_value(v, strings);+ }+ }+ _ => {}+ }+}++/// Replace all deprecated variables with their new names+pub fn replace_deprecated_vars(content: &str) -> String {+ use regex::Regex;++ let strings = extract_template_strings(content);+ let mut result = content.to_string();++ for original in strings {+ let mut modified = original.clone();+ for &(old, new) in DEPRECATED_VARS {+ let re = Regex::new(&format!(r"\b{}\b", regex::escape(old))).unwrap();+ modified = re.replace_all(&modified, new).into_owned();+ }+ if modified != original {+ result = result.replace(&original, &modified);+ }+ }++ result+}++/// Check config content for deprecated variables and optionally create migration file+///+/// If deprecated variables are found and `warn_and_migrate` is true:+/// 1. Emits a warning listing the deprecated variables+/// 2. Creates a `.new` file with replacements+///+/// Set `warn_and_migrate` to false for project config on feature worktrees - the warning+/// is only actionable from the main worktree where the migration file can be applied.+///+/// The `label` is used in the warning message (e.g., "User config" or "Project config").+///+/// Warnings are deduplicated per path per process.+///+/// Returns Ok(true) if deprecated variables were found, Ok(false) otherwise.+pub fn check_and_migrate(+ path: &Path,+ content: &str,+ warn_and_migrate: bool,+ label: &str,+) -> anyhow::Result<bool> {+ let deprecated = find_deprecated_vars(content);+ if deprecated.is_empty() {+ return Ok(false);+ }++ // Skip warning entirely if not in main worktree (for project config)+ if !warn_and_migrate {+ return Ok(true);+ }++ // Deduplicate warnings per path per process+ let canonical_path = path.canonicalize().unwrap_or_else(|_| path.to_path_buf());+ {+ let mut guard = WARNED_PATHS.lock().unwrap();+ let warned = guard.get_or_insert_with(HashSet::new);+ if warned.contains(&canonical_path) {+ return Ok(true); // Already warned, skip+ }+ warned.insert(canonical_path.clone());+ }++ // Build inline list of deprecated variables: "repo_root → repo_path, worktree → worktree_path"+ let var_list: Vec<String> = deprecated+ .iter()+ .map(|(old, new)| cformat!("<dim>{}</> → <bold>{}</>", old, new))+ .collect();++ let warning = format!(+ "{} uses deprecated template variables: {}",+ label,+ var_list.join(", ")+ );+ eprintln!("{}", warning_message(warning));++ let new_content = replace_deprecated_vars(content);++ // Build the .new path: "config.toml" -> "config.toml.new"+ let new_path = path.with_extension(format!(+ "{}.new",+ path.extension().unwrap_or_default().to_string_lossy()+ ));++ // Attempt to write migration file, but don't fail config loading if it fails+ match std::fs::write(&new_path, new_content) {+ Ok(()) => {+ // Show just the filename in the message, full paths in the command+ let new_filename = new_path+ .file_name()+ .map(|n| n.to_string_lossy())+ .unwrap_or_default();++ // Shell-escape paths for safe copy-paste+ let new_path_str = new_path.to_string_lossy();+ let path_str = path.to_string_lossy();+ let new_path_escaped = escape(Cow::Borrowed(new_path_str.as_ref()));+ let path_escaped = escape(Cow::Borrowed(path_str.as_ref()));+ eprintln!(+ "{}",+ hint_message(cformat!(+ "Wrote migrated {}; to apply: <bright-black>mv -- {} {}</>",+ new_filename,+ new_path_escaped,+ path_escaped+ ))+ );+ }+ Err(e) => {+ // Warn about write failure but don't block config loading+ eprintln!(+ "{}",+ hint_message(cformat!(+ "Could not write migration file: <bright-black>{}</>",+ e+ ))+ );+ }+ }++ // Flush stderr to ensure output appears before any subsequent messages+ std::io::stderr().flush().ok();++ Ok(true)+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn test_find_deprecated_vars_empty() {+ let content = r#"+worktree-path = "../{{ repo }}.{{ branch | sanitize }}"+"#;+ let found = find_deprecated_vars(content);+ assert!(found.is_empty());+ }++ #[test]+ fn test_find_deprecated_vars_repo_root() {+ let content = r#"+post-create = "ln -sf {{ repo_root }}/node_modules node_modules"+"#;+ let found = find_deprecated_vars(content);+ assert_eq!(found, vec![("repo_root", "repo_path")]);+ }++ #[test]+ fn test_find_deprecated_vars_worktree() {+ let content = r#"+post-create = "cd {{ worktree }} && npm install"+"#;+ let found = find_deprecated_vars(content);+ assert_eq!(found, vec![("worktree", "worktree_path")]);+ }++ #[test]+ fn test_find_deprecated_vars_main_worktree() {+ let content = r#"+worktree-path = "../{{ main_worktree }}.{{ branch | sanitize }}"+"#;+ let found = find_deprecated_vars(content);+ assert_eq!(found, vec![("main_worktree", "repo")]);+ }++ #[test]+ fn test_find_deprecated_vars_multiple() {+ let content = r#"+worktree-path = "../{{ main_worktree }}.{{ branch | sanitize }}"+post-create = "ln -sf {{ repo_root }}/node_modules {{ worktree }}/node_modules"+"#;+ let found = find_deprecated_vars(content);+ assert_eq!(+ found,+ vec![+ ("repo_root", "repo_path"),+ ("worktree", "worktree_path"),+ ("main_worktree", "repo"),+ ]+ );+ }++ #[test]+ fn test_find_deprecated_vars_with_filter() {+ let content = r#"+post-create = "ln -sf {{ repo_root | something }}/node_modules"+"#;+ let found = find_deprecated_vars(content);+ assert_eq!(found, vec![("repo_root", "repo_path")]);+ }++ #[test]+ fn test_find_deprecated_vars_deduplicates() {+ let content = r#"+post-create = "{{ repo_root }}/a {{ repo_root }}/b"+"#;+ let found = find_deprecated_vars(content);+ assert_eq!(found, vec![("repo_root", "repo_path")]);+ }++ #[test]+ fn test_find_deprecated_vars_does_not_match_suffix() {+ // Should NOT match "worktree_path" when looking for "worktree"+ let content = r#"+post-create = "cd {{ worktree_path }} && npm install"+"#;+ let found = find_deprecated_vars(content);+ assert!(+ found.is_empty(),+ "Should not match worktree_path as worktree"+ );+ }++ #[test]+ fn test_replace_deprecated_vars_simple() {+ let content = r#"cmd = "{{ repo_root }}""#;+ let result = replace_deprecated_vars(content);+ assert_eq!(result, r#"cmd = "{{ repo_path }}""#);+ }++ #[test]+ fn test_replace_deprecated_vars_with_filter() {+ let content = r#"cmd = "{{ repo_root | sanitize }}""#;+ let result = replace_deprecated_vars(content);+ assert_eq!(result, r#"cmd = "{{ repo_path | sanitize }}""#);+ }++ #[test]+ fn test_replace_deprecated_vars_no_spaces() {+ let content = r#"cmd = "{{repo_root}}""#;+ let result = replace_deprecated_vars(content);+ assert_eq!(result, r#"cmd = "{{repo_path}}""#); // Preserves original formatting+ }++ #[test]+ fn test_replace_deprecated_vars_filter_no_spaces() {+ let content = r#"cmd = "{{repo_root|sanitize}}""#;+ let result = replace_deprecated_vars(content);+ assert_eq!(result, r#"cmd = "{{repo_path|sanitize}}""#); // Preserves original formatting+ }++ #[test]+ fn test_replace_deprecated_vars_multiple() {+ let content = r#"+worktree-path = "../{{ main_worktree }}.{{ branch | sanitize }}"+post-create = "ln -sf {{ repo_root }}/node_modules {{ worktree }}/node_modules"+"#;+ let result = replace_deprecated_vars(content);+ assert_eq!(+ result,+ r#"+worktree-path = "../{{ repo }}.{{ branch | sanitize }}"+post-create = "ln -sf {{ repo_path }}/node_modules {{ worktree_path }}/node_modules"+"#+ );+ }++ #[test]+ fn test_replace_deprecated_vars_preserves_other_content() {+ let content = r#"+# This is a comment+worktree-path = "../{{ repo }}.{{ branch }}"++[hooks]+post-create = "echo hello"+"#;+ let result = replace_deprecated_vars(content);+ assert_eq!(result, content); // No changes since no deprecated vars+ }++ #[test]+ fn test_replace_deprecated_vars_preserves_whitespace() {+ let content = r#"cmd = "{{ repo_root }}""#;+ let result = replace_deprecated_vars(content);+ assert_eq!(result, r#"cmd = "{{ repo_path }}""#); // Preserves original formatting+ }++ #[test]+ fn test_replace_does_not_match_suffix() {+ // Should NOT replace "worktree_path" when looking for "worktree"+ let content = r#"cmd = "{{ worktree_path }}""#;+ let result = replace_deprecated_vars(content);+ assert_eq!(+ result, r#"cmd = "{{ worktree_path }}""#,+ "Should not modify worktree_path"+ );+ }++ #[test]+ fn test_replace_in_statement_blocks() {+ // Word boundary replacement handles {% %} blocks too+ let content = r#"cmd = "{% if repo_root %}echo {{ repo_root }}{% endif %}""#;+ let result = replace_deprecated_vars(content);+ assert_eq!(+ result,+ r#"cmd = "{% if repo_path %}echo {{ repo_path }}{% endif %}""#+ );+ }+}diff --git a/src/config/mod.rs b/src/config/mod.rsindex 936673794..158cbac08 100644--- a/src/config/mod.rs+++ b/src/config/mod.rs@@ -16,6 +16,7 @@//! See `wt config --help` for complete documentation.mod commands;+mod deprecation;mod expansion;mod hooks;mod project;@@ -25,6 +26,7 @@ mod user;// Re-export public typespub use commands::{Command, CommandConfig};+pub use deprecation::check_and_migrate as check_deprecated_vars;pub use expansion::{expand_template, sanitize_branch_name};pub use hooks::HooksConfig;pub use project::{@@ -44,7 +46,7 @@ mod tests {let config = WorktrunkConfig::default();let toml = toml::to_string(&config).unwrap();assert!(toml.contains("worktree-path"));- assert!(toml.contains("../{{ main_worktree }}.{{ branch | sanitize }}"));+ assert!(toml.contains("../{{ repo }}.{{ branch | sanitize }}"));assert!(toml.contains("commit-generation"));}@@ -53,7 +55,7 @@ mod tests {let config = WorktrunkConfig::default();assert_eq!(config.worktree_path,- "../{{ main_worktree }}.{{ branch | sanitize }}"+ "../{{ repo }}.{{ branch | sanitize }}");assert_eq!(config.commit_generation.command, None);assert!(config.projects.is_empty());diff --git a/src/config/project.rs b/src/config/project.rsindex 9f9ea6981..653009183 100644--- a/src/config/project.rs+++ b/src/config/project.rs@@ -48,11 +48,12 @@ impl ProjectListConfig {/// # Template Variables////// All hooks support these template variables:-/// - `{{ repo }}` - Repository name (e.g., "my-project")+/// - `{{ repo }}` - Repository directory name (e.g., "my-project")+/// - `{{ repo_path }}` - Absolute path to repository root/// - `{{ branch }}` - Branch name (e.g., "feature-foo")-/// - `{{ worktree }}` - Absolute path to the worktree/// - `{{ worktree_name }}` - Worktree directory name (e.g., "my-project.feature-foo")-/// - `{{ repo_root }}` - Absolute path to the repository root+/// - `{{ worktree_path }}` - Absolute path to the worktree+/// - `{{ main_worktree_path }}` - Absolute path to the default branch worktree/// - `{{ default_branch }}` - Default branch name (e.g., "main")/// - `{{ commit }}` - Current HEAD commit SHA (full 40-character hash)/// - `{{ short_commit }}` - Current HEAD commit SHA (short 7-character hash)@@ -94,6 +95,17 @@ impl ProjectConfig {let contents = std::fs::read_to_string(&config_path).map_err(|e| ConfigError::Message(format!("Failed to read config file: {}", e)))?;+ // Check for deprecated template variables and create migration file if needed+ // Only write migration file in main worktree (where .git is a directory)+ // Linked worktrees have .git as a file pointing to the main worktree+ let is_main_worktree = repo_root.join(".git").is_dir();+ let _ = super::deprecation::check_and_migrate(+ &config_path,+ &contents,+ is_main_worktree,+ "Project config",+ );+let config: ProjectConfig = toml::from_str(&contents).map_err(|e| ConfigError::Message(format!("Failed to parse TOML: {}", e)))?;diff --git a/src/config/user.rs b/src/config/user.rsindex 94167c74f..3101dbe6d 100644--- a/src/config/user.rs+++ b/src/config/user.rs@@ -91,7 +91,7 @@ pub enum StageMode {////// The `worktree-path` template is relative to the repository root./// Supported variables:-/// - `{{ main_worktree }}` - Main worktree directory name+/// - `{{ repo }}` - Repository directory name/// - `{{ branch }}` - Raw branch name (e.g., `feature/foo`)/// - `{{ branch | sanitize }}` - Branch name with `/` and `\` replaced by `-`///@@ -99,13 +99,13 @@ pub enum StageMode {////// ```toml/// # Default - parent directory siblings-/// worktree-path = "../{{ main_worktree }}.{{ branch | sanitize }}"+/// worktree-path = "../{{ repo }}.{{ branch | sanitize }}"////// # Inside repo (clean, no redundant directory)/// worktree-path = ".worktrees/{{ branch | sanitize }}"////// # Repository-namespaced (useful for shared directories with multiple repos)-/// worktree-path = "../worktrees/{{ main_worktree }}/{{ branch | sanitize }}"+/// worktree-path = "../worktrees/{{ repo }}/{{ branch | sanitize }}"////// # Commit generation configuration/// [commit-generation]@@ -295,7 +295,7 @@ pub struct MergeConfig {/// Default worktree path template (used by serde)fn default_worktree_path() -> String {- "../{{ main_worktree }}.{{ branch | sanitize }}".to_string()+ "../{{ repo }}.{{ branch | sanitize }}".to_string()}impl Default for WorktrunkConfig {@@ -336,7 +336,18 @@ impl WorktrunkConfig {if let Some(config_path) = get_config_path()&& config_path.exists(){- builder = builder.add_source(File::from(config_path));+ // Check for deprecated template variables and create migration file if needed+ // User config always gets migration file (it's global, not worktree-specific)+ if let Ok(content) = std::fs::read_to_string(&config_path) {+ let _ = super::deprecation::check_and_migrate(+ &config_path,+ &content,+ true,+ "User config",+ );+ }++ builder = builder.add_source(File::from(config_path.clone()));}// Add environment variables with WORKTRUNK prefix@@ -882,7 +893,7 @@ rename-tab = "echo 'switched'"let config = WorktrunkConfig::default();assert_eq!(config.worktree_path,- "../{{ main_worktree }}.{{ branch | sanitize }}"+ "../{{ repo }}.{{ branch | sanitize }}");assert!(config.projects.is_empty());assert!(config.list.is_none());diff --git a/tests/common/mod.rs b/tests/common/mod.rsindex 10491a133..29d162d11 100644--- a/tests/common/mod.rs+++ b/tests/common/mod.rs@@ -1231,7 +1231,7 @@ impl TestRepo {/// (sanitized, with slashes replaced by dashes).pub fn add_worktree(&mut self, branch: &str) -> PathBuf {let safe_branch = sanitize_branch_name(branch);- // Use default template path format: ../{{ main_worktree }}.{{ branch }}+ // Use default template path format: ../{{ repo }}.{{ branch }}// From {temp_dir}/repo, this resolves to {temp_dir}/repo.{branch}let worktree_path = self.temp_dir.path().join(format!("repo.{}", safe_branch));let worktree_str = worktree_path.to_str().unwrap();@@ -2031,10 +2031,23 @@ pub fn setup_snapshot_settings(repo: &TestRepo) -> insta::Settings {// Normalize WORKTRUNK_CONFIG_PATH temp paths in stdout/stderr output// (metadata is handled via redactions below)// IMPORTANT: These specific filters must come BEFORE the generic [PROJECT_ID] filters- settings.add_filter(r".*/\.tmp[^/]+/test-config\.toml", "[TEST_CONFIG]");+ // Handles: Unix paths (/tmp/...), Windows paths (C:\...), and shell-escaped quoted paths ('C:\...')+ // Use distinct placeholders for config.toml vs config.toml.new for clarity+ settings.add_filter(+ r"'?(?:[A-Z]:)?[/\\][^\s']+[/\\]\.tmp[^/\\']+[/\\]test-config\.toml\.new'?",+ "[TEST_CONFIG_NEW]",+ );+ settings.add_filter(+ r"'?(?:[A-Z]:)?[/\\][^\s']+[/\\]\.tmp[^/\\']+[/\\]test-config\.toml'?",+ "[TEST_CONFIG]",+ );// Normalize GIT_CONFIG_GLOBAL temp paths- settings.add_filter(r".*/\.tmp[^/]+/test-gitconfig", "[TEST_GIT_CONFIG]");+ // (?:[A-Z]:)? handles Windows drive letters+ settings.add_filter(+ r"(?:[A-Z]:)?/[^\s]+/\.tmp[^/]+/test-gitconfig",+ "[TEST_GIT_CONFIG]",+ );// Normalize temp directory paths in project identifiers (approval prompts)// Example: /private/var/folders/wf/.../T/.tmpABC123/origin -> [PROJECT_ID]diff --git a/tests/integration_tests/approval_save.rs b/tests/integration_tests/approval_save.rsindex 8e72ce79c..3debcd937 100644--- a/tests/integration_tests/approval_save.rs+++ b/tests/integration_tests/approval_save.rs@@ -33,7 +33,7 @@ fn test_approval_saves_to_disk() {// Verify TOML structurelet toml_content = fs::read_to_string(&config_path).unwrap();assert_snapshot!(toml_content, @r#"- worktree-path = "../{{ main_worktree }}.{{ branch | sanitize }}"+ worktree-path = "../{{ repo }}.{{ branch | sanitize }}"[commit-generation]args = []@@ -89,7 +89,7 @@ fn test_duplicate_approvals_not_saved_twice() {// Verify file contains only one entrylet toml_content = fs::read_to_string(&config_path).unwrap();assert_snapshot!(toml_content, @r#"- worktree-path = "../{{ main_worktree }}.{{ branch | sanitize }}"+ worktree-path = "../{{ repo }}.{{ branch | sanitize }}"[commit-generation]args = []@@ -141,7 +141,7 @@ fn test_multiple_project_approvals() {// Verify file structurelet toml_content = fs::read_to_string(&config_path).unwrap();assert_snapshot!(toml_content, @r#"- worktree-path = "../{{ main_worktree }}.{{ branch | sanitize }}"+ worktree-path = "../{{ repo }}.{{ branch | sanitize }}"[commit-generation]args = []@@ -230,7 +230,7 @@ fn test_yes_flag_does_not_save_approval() {// Load the config and verify it's still empty (no approvals added)let saved_config = fs::read_to_string(&config_path).unwrap();assert_snapshot!(saved_config, @r#"- worktree-path = "../{{ main_worktree }}.{{ branch | sanitize }}"+ worktree-path = "../{{ repo }}.{{ branch | sanitize }}"[commit-generation]args = []@@ -264,7 +264,7 @@ fn test_approval_saves_to_new_config_file() {// Verify contentlet content = fs::read_to_string(&config_path).unwrap();assert_snapshot!(content, @r#"- worktree-path = "../{{ main_worktree }}.{{ branch | sanitize }}"+ worktree-path = "../{{ repo }}.{{ branch | sanitize }}"[commit-generation]args = []@@ -620,7 +620,7 @@ fn test_skip_shell_integration_prompt_saves_to_disk() {// Verify TOML structurelet toml_content = fs::read_to_string(&config_path).unwrap();assert_snapshot!(toml_content, @r#"- worktree-path = "../{{ main_worktree }}.{{ branch | sanitize }}"+ worktree-path = "../{{ repo }}.{{ branch | sanitize }}"skip-shell-integration-prompt = true[commit-generation]diff --git a/tests/integration_tests/approval_ui.rs b/tests/integration_tests/approval_ui.rsindex e79f2c7b5..1f5e7b29d 100644--- a/tests/integration_tests/approval_ui.rs+++ b/tests/integration_tests/approval_ui.rs@@ -43,7 +43,7 @@ fn snapshot_approval(test_name: &str, repo: &TestRepo, args: &[&str], approve: b#[rstest]fn test_approval_single_command(repo: TestRepo) {- repo.write_project_config(r#"post-create = "echo 'Worktree path: {{ worktree }}'""#);+ repo.write_project_config(r#"post-create = "echo 'Worktree path: {{ worktree_path }}'""#);repo.commit("Add config");@@ -60,9 +60,9 @@ fn test_approval_multiple_commands(repo: TestRepo) {repo.write_project_config(r#"[post-create]branch = "echo 'Branch: {{ branch }}'"-worktree = "echo 'Worktree: {{ worktree }}'"-repo = "echo 'Repo: {{ main_worktree }}'"-pwd = "cd {{ worktree }} && pwd"+worktree = "echo 'Worktree: {{ worktree_path }}'"+repo = "echo 'Repo: {{ repo }}'"+pwd = "cd {{ worktree_path }} && pwd""#,);diff --git a/tests/integration_tests/config_init.rs b/tests/integration_tests/config_init.rsindex d7ff314c6..92c4e7cd1 100644--- a/tests/integration_tests/config_init.rs+++ b/tests/integration_tests/config_init.rs@@ -15,7 +15,7 @@ fn test_config_init_already_exists(temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();diff --git a/tests/integration_tests/config_show.rs b/tests/integration_tests/config_show.rsindex b2db82419..6539bcd4e 100644--- a/tests/integration_tests/config_show.rs+++ b/tests/integration_tests/config_show.rs@@ -17,7 +17,7 @@ fn test_config_show_with_project_config(mut repo: TestRepo, temp_home: TempDir)fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}"[projects."test-project"]approved-commands = ["npm install"]@@ -61,7 +61,7 @@ fn test_config_show_no_project_config(mut repo: TestRepo, temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();@@ -91,7 +91,7 @@ fn test_config_show_outside_git_repo(mut repo: TestRepo, temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();@@ -324,7 +324,7 @@ fn test_config_show_warns_unknown_project_keys(mut repo: TestRepo, temp_home: Tefs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- "worktree-path = \"../{{ main_worktree }}.{{ branch }}\"",+ "worktree-path = \"../{{ repo }}.{{ branch }}\"",).unwrap();@@ -360,7 +360,7 @@ fn test_config_show_warns_unknown_user_keys(mut repo: TestRepo, temp_home: TempDfs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- "worktree-path = \"../{{ main_worktree }}.{{ branch }}\"\n\n[commit-gen]\ncommand = \"llm\"",+ "worktree-path = \"../{{ repo }}.{{ branch }}\"\n\n[commit-gen]\ncommand = \"llm\"",).unwrap();@@ -388,7 +388,7 @@ fn test_config_show_full_not_configured(mut repo: TestRepo, temp_home: TempDir)let config_path = global_config_dir.join("config.toml");fs::write(&config_path,- "worktree-path = \"../{{ main_worktree }}.{{ branch }}\"",+ "worktree-path = \"../{{ repo }}.{{ branch }}\"",).unwrap();@@ -421,7 +421,7 @@ fn test_config_show_full_command_not_found(mut repo: TestRepo, temp_home: TempDilet config_path = global_config_dir.join("config.toml");fs::write(&config_path,- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}"[commit-generation]command = "nonexistent-llm-command-12345"@@ -469,7 +469,7 @@ fn test_config_show_github_remote(mut repo: TestRepo, temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();@@ -508,7 +508,7 @@ fn test_config_show_gitlab_remote(mut repo: TestRepo, temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();@@ -536,7 +536,7 @@ fn test_config_show_empty_project_config(mut repo: TestRepo, temp_home: TempDir)fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();@@ -569,7 +569,7 @@ fn test_config_show_whitespace_only_project_config(mut repo: TestRepo, temp_homefs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();@@ -629,6 +629,64 @@ alias wt="git worktree"});}+/// Test deprecated template variables show warning with migration hint+///+/// When a config uses deprecated variables (repo_root, worktree, main_worktree),+/// the CLI should:+/// 1. Show a warning listing the deprecated variables and their replacements+/// 2. Create a .new migration file with replacements+/// 3. Show a hint with the mv command to apply the migration+#[rstest]+fn test_deprecated_template_variables_show_warning(repo: TestRepo, temp_home: TempDir) {+ // Write config with deprecated variables to the test config path+ // (WORKTRUNK_CONFIG_PATH overrides XDG paths in tests)+ let config_path = repo.test_config_path();+ fs::write(+ config_path,+ // Use all deprecated variables: repo_root, worktree, main_worktree+ r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"++[hooks]+post-create = "ln -sf {{ repo_root }}/node_modules {{ worktree }}/node_modules"+"#,+ )+ .unwrap();++ // Use `wt list` which loads config through WorktrunkConfig::load() and triggers deprecation check+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);+ settings.bind(|| {+ let mut cmd = wt_command();+ repo.configure_wt_cmd(&mut cmd);+ cmd.arg("list").current_dir(repo.root_path());+ set_temp_home_env(&mut cmd, temp_home.path());++ assert_cmd_snapshot!(cmd);+ });++ // Verify migration file was created (config.toml -> config.toml.new)+ let migration_file = config_path.with_extension("toml.new");+ assert!(+ migration_file.exists(),+ "Migration file should be created at {:?}",+ migration_file+ );++ // Verify migration file has replacements+ let migrated_content = fs::read_to_string(&migration_file).unwrap();+ assert!(+ migrated_content.contains("{{ repo }}"),+ "Migration should replace main_worktree with repo"+ );+ assert!(+ migrated_content.contains("{{ repo_path }}"),+ "Migration should replace repo_root with repo_path"+ );+ assert!(+ migrated_content.contains("{{ worktree_path }}"),+ "Migration should replace worktree with worktree_path"+ );+}+/// Test `wt config show` with shell integration active (WORKTRUNK_DIRECTIVE_FILE set)#[rstest]fn test_config_show_shell_integration_active(mut repo: TestRepo, temp_home: TempDir) {@@ -640,7 +698,7 @@ fn test_config_show_shell_integration_active(mut repo: TestRepo, temp_home: Tempfs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();diff --git a/tests/integration_tests/e2e_shell_post_start.rs b/tests/integration_tests/e2e_shell_post_start.rsindex 799bc8ef6..9269b208e 100644--- a/tests/integration_tests/e2e_shell_post_start.rs+++ b/tests/integration_tests/e2e_shell_post_start.rs@@ -44,9 +44,7 @@ fn test_shell_integration_post_start_background(#[case] shell: &str, repo: TestR// Pre-approve the commandfs::write(repo.test_config_path(),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["sleep 0.05 && echo 'Background task done' > bg_marker.txt"]"#,)@@ -137,9 +135,7 @@ task2 = "sleep 0.05 && echo 'Task 2' > task2.txt"// Pre-approve commandsfs::write(repo.test_config_path(),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["sleep 0.05 && echo 'Task 1' > task1.txt","sleep 0.05 && echo 'Task 2' > task2.txt",@@ -204,9 +200,7 @@ fn test_bash_shell_integration_post_create_blocks(repo: TestRepo) {// Pre-approve commandfs::write(repo.test_config_path(),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'Setup done' > setup.txt"]"#,)@@ -275,9 +269,7 @@ fish_bg = "sleep 0.05 && echo 'Fish background done' > fish_bg.txt"// Pre-approve commandfs::write(repo.test_config_path(),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["sleep 0.05 && echo 'Fish background done' > fish_bg.txt"]"#,)diff --git a/tests/integration_tests/hook_show.rs b/tests/integration_tests/hook_show.rsindex e06daeaeb..aa2c37c8a 100644--- a/tests/integration_tests/hook_show.rs+++ b/tests/integration_tests/hook_show.rs@@ -17,7 +17,7 @@ fn test_hook_show_with_both_configs(repo: TestRepo, temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}"[pre-commit]user-lint = "pre-commit run --all-files"@@ -56,7 +56,7 @@ fn test_hook_show_no_hooks(repo: TestRepo, temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();@@ -80,7 +80,7 @@ fn test_hook_show_filter_by_type(repo: TestRepo, temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();@@ -123,7 +123,7 @@ fn test_hook_show_approval_status(repo: TestRepo, temp_home: TempDir) {let config_path = global_config_dir.join("config.toml");fs::write(&config_path,- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}"[projects."repo"]approved-commands = ["cargo build"]@@ -177,7 +177,7 @@ fn test_hook_show_project_config_no_hooks(repo: TestRepo, temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();@@ -211,7 +211,7 @@ fn test_hook_show_outside_git_repo(temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}"[pre-commit]lint = "pre-commit run"diff --git a/tests/integration_tests/list_config.rs b/tests/integration_tests/list_config.rsindex 501cea48e..868378b7e 100644--- a/tests/integration_tests/list_config.rs+++ b/tests/integration_tests/list_config.rs@@ -16,7 +16,7 @@ fn test_list_config_full_enabled(repo: TestRepo, temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}"[projects."repo".list]full = true@@ -46,7 +46,7 @@ fn test_list_config_branches_enabled(repo: TestRepo, temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}"[projects."repo".list]branches = true@@ -76,7 +76,7 @@ fn test_list_config_cli_override(repo: TestRepo, temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}"[projects."repo".list]branches = false@@ -109,7 +109,7 @@ fn test_list_config_full_and_branches(repo: TestRepo, temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}"[projects."repo".list]full = true@@ -140,7 +140,7 @@ fn test_list_no_config(repo: TestRepo, temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();@@ -171,7 +171,7 @@ url = "http://localhost:{{ branch | hash_port }}"fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();@@ -202,7 +202,7 @@ url = "http://localhost:{{ branch | hash_port }}"fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();@@ -241,7 +241,7 @@ fn test_list_json_no_url_without_template(repo: TestRepo, temp_home: TempDir) {fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();@@ -284,7 +284,7 @@ url = "http://localhost:{{ branch | hash_port }}"fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();@@ -325,7 +325,7 @@ url = "http://localhost:8080/{{ branch }}"fs::create_dir_all(&global_config_dir).unwrap();fs::write(global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"+ r#"worktree-path = "../{{ repo }}.{{ branch }}""#,).unwrap();diff --git a/tests/integration_tests/post_start_commands.rs b/tests/integration_tests/post_start_commands.rsindex e0ae5ad2c..06dac73ed 100644--- a/tests/integration_tests/post_start_commands.rs+++ b/tests/integration_tests/post_start_commands.rs@@ -51,9 +51,7 @@ fn test_post_create_single_command(repo: TestRepo) {// Pre-approve the command by writing to the isolated test configrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'Setup complete'"]"#,);@@ -80,9 +78,7 @@ setup = "echo 'Running setup'"// Pre-approve both commands in temp HOMErepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'Installing deps'","echo 'Running setup'",@@ -107,9 +103,7 @@ fn test_post_create_failing_command(repo: TestRepo) {// Pre-approve the command in temp HOMErepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["exit 1"]"#,);@@ -127,11 +121,11 @@ fn test_post_create_template_expansion(repo: TestRepo) {// Create project config with template variablesrepo.write_project_config(r#"[post-create]-repo = "echo 'Repo: {{ main_worktree }}' > info.txt"+repo = "echo 'Repo: {{ repo }}' > info.txt"branch = "echo 'Branch: {{ branch }}' >> info.txt"hash_port = "echo 'Port: {{ branch | hash_port }}' >> info.txt"-worktree = "echo 'Worktree: {{ worktree }}' >> info.txt"-root = "echo 'Root: {{ repo_root }}' >> info.txt"+worktree = "echo 'Worktree: {{ worktree_path }}' >> info.txt"+root = "echo 'Root: {{ repo_path }}' >> info.txt""#,);@@ -140,15 +134,15 @@ root = "echo 'Root: {{ repo_root }}' >> info.txt"// Pre-approve all commands in isolated test configlet repo_name = "repo";repo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch | sanitize }}"+ r#"worktree-path = "../{{ repo }}.{{ branch | sanitize }}"[projects."repo"]approved-commands = [- "echo 'Repo: {{ main_worktree }}' > info.txt",+ "echo 'Repo: {{ repo }}' > info.txt","echo 'Branch: {{ branch }}' >> info.txt","echo 'Port: {{ branch | hash_port }}' >> info.txt",- "echo 'Worktree: {{ worktree }}' >> info.txt",- "echo 'Root: {{ repo_root }}' >> info.txt",+ "echo 'Worktree: {{ worktree_path }}' >> info.txt",+ "echo 'Root: {{ repo_path }}' >> info.txt",]"#,);@@ -215,9 +209,7 @@ fn test_post_create_default_branch_template(repo: TestRepo) {// Pre-approve the commandrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'Default: {{ default_branch }}' > default.txt"]"#,);@@ -371,9 +363,7 @@ fn test_post_create_json_stdin(repo: TestRepo) {// Pre-approve the commandrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["cat > context.json"]"#,);@@ -473,9 +463,7 @@ setup = "./scripts/setup.py"// Pre-approve the commandrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["./scripts/setup.py"]"#,);@@ -543,9 +531,7 @@ fn test_post_start_json_stdin(repo: TestRepo) {// Pre-approve the commandrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["cat > context.json"]"#,);@@ -601,9 +587,7 @@ fn test_post_start_single_background_command(repo: TestRepo) {// Pre-approve the commandrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["sleep 0.1 && echo 'Background task done' > background.txt"]"#,);@@ -640,9 +624,7 @@ task2 = "echo 'Task 2 running' > task2.txt"// Pre-approve both commandsrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'Task 1 running' > task1.txt","echo 'Task 2 running' > task2.txt",@@ -684,9 +666,7 @@ server = "sleep 0.05 && echo 'Server running' > server.txt"// Pre-approve all commandsrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'Setup done' > setup.txt","sleep 0.05 && echo 'Server running' > server.txt",@@ -735,9 +715,7 @@ fn test_post_start_log_file_captures_output(repo: TestRepo) {// Pre-approve the commandrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'stdout output' && echo 'stderr output' >&2"]"#,);@@ -791,9 +769,7 @@ fn test_post_start_invalid_command_handling(repo: TestRepo) {// Pre-approve the commandrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'unclosed quote"]"#,);@@ -828,9 +804,7 @@ task3 = "echo 'TASK3_OUTPUT'"// Pre-approve all commandsrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'TASK1_OUTPUT'","echo 'TASK2_OUTPUT'",@@ -903,9 +877,7 @@ fn test_execute_flag_with_post_start_commands(repo: TestRepo) {// Pre-approve the commandrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'Background task' > background.txt"]"#,);@@ -948,9 +920,7 @@ fn test_post_start_complex_shell_commands(repo: TestRepo) {// Pre-approve the commandrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'line1\nline2\nline3' | grep line2 > filtered.txt"]"#,);@@ -986,7 +956,7 @@ echo 'second line' >> multiline.txtecho 'third line' >> multiline.txt";repo.write_test_config(&format!(- r#"worktree-path = "../{{{{ main_worktree }}}}.{{{{ branch }}}}"+ r#"worktree-path = "../{{{{ repo }}}}.{{{{ branch }}}}"[projects."repo"]approved-commands = ["""@@ -1038,7 +1008,7 @@ elsefi";repo.write_test_config(&format!(- r#"worktree-path = "../{{{{ main_worktree }}}}.{{{{ branch }}}}"+ r#"worktree-path = "../{{{{ repo }}}}.{{{{ branch }}}}"[projects."repo"]approved-commands = ["""@@ -1082,9 +1052,7 @@ fn test_post_start_skipped_on_existing_worktree(repo: TestRepo) {// Pre-approve the commandrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'POST-START-RAN' > post_start_marker.txt"]"#,);diff --git a/tests/integration_tests/remove.rs b/tests/integration_tests/remove.rsindex 4757dda87..de4e45cdb 100644--- a/tests/integration_tests/remove.rs+++ b/tests/integration_tests/remove.rs@@ -925,9 +925,7 @@ fn test_pre_remove_hook_executes(mut repo: TestRepo) {// Pre-approve the commandrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'About to remove worktree'"]"#,);@@ -951,7 +949,7 @@ fn test_pre_remove_hook_template_variables(mut repo: TestRepo) {repo.write_project_config(r#"[pre-remove]branch = "echo 'Branch: {{ branch }}'"-worktree = "echo 'Worktree: {{ worktree }}'"+worktree = "echo 'Worktree: {{ worktree_path }}'"worktree_name = "echo 'Name: {{ worktree_name }}'""#,);@@ -959,12 +957,10 @@ worktree_name = "echo 'Name: {{ worktree_name }}'"// Pre-approve the commands (templates match what's shown in prompts)repo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'Branch: {{ branch }}'",- "echo 'Worktree: {{ worktree }}'",+ "echo 'Worktree: {{ worktree_path }}'","echo 'Name: {{ worktree_name }}'",]"#,@@ -999,7 +995,7 @@ fn test_pre_remove_hook_runs_in_background_mode(mut repo: TestRepo) {// Pre-approve the commandrepo.write_test_config(&format!(- r#"worktree-path = "../{{{{ main_worktree }}}}.{{{{ branch }}}}"+ r#"worktree-path = "../{{{{ repo }}}}.{{{{ branch }}}}"[projects."repo"]approved-commands = ["echo 'hook ran' > {}"]@@ -1037,9 +1033,7 @@ fn test_pre_remove_hook_failure_aborts(mut repo: TestRepo) {// Pre-approve the commandrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["exit 1"]"#,);@@ -1077,7 +1071,7 @@ fn test_pre_remove_hook_not_for_branch_only(repo: TestRepo) {// Pre-approve the commandrepo.write_test_config(&format!(- r#"worktree-path = "../{{{{ main_worktree }}}}.{{{{ branch }}}}"+ r#"worktree-path = "../{{{{ repo }}}}.{{{{ branch }}}}"[projects."repo"]approved-commands = ["echo 'hook ran' > {}"]@@ -1123,7 +1117,7 @@ fn test_pre_remove_hook_skipped_with_no_verify(mut repo: TestRepo) {// Pre-approve the command (even though it shouldn't run)repo.write_test_config(&format!(- r#"worktree-path = "../{{{{ main_worktree }}}}.{{{{ branch }}}}"+ r#"worktree-path = "../{{{{ repo }}}}.{{{{ branch }}}}"[projects."repo"]approved-commands = ["echo 'hook ran' > {}"]@@ -1181,7 +1175,7 @@ fn test_pre_remove_hook_runs_for_detached_head(mut repo: TestRepo) {// Pre-approve the commandrepo.write_test_config(&format!(- r#"worktree-path = "../{{{{ main_worktree }}}}.{{{{ branch }}}}"+ r#"worktree-path = "../{{{{ repo }}}}.{{{{ branch }}}}"[projects."repo"]approved-commands = ["touch {marker_path}"]@@ -1223,7 +1217,7 @@ fn test_pre_remove_hook_runs_for_detached_head_background(mut repo: TestRepo) {// Pre-approve the commandsrepo.write_test_config(&format!(- r#"worktree-path = "../{{{{ main_worktree }}}}.{{{{ branch }}}}"+ r#"worktree-path = "../{{{{ repo }}}}.{{{{ branch }}}}"[projects."repo"]approved-commands = ["touch {marker_path}"]@@ -1274,7 +1268,7 @@ fn test_pre_remove_hook_branch_expansion_detached_head(mut repo: TestRepo) {// Pre-approve the commandrepo.write_test_config(&format!(- r#"worktree-path = "../{{{{ main_worktree }}}}.{{{{ branch }}}}"+ r#"worktree-path = "../{{{{ repo }}}}.{{{{ branch }}}}"[projects."repo"]approved-commands = ["echo 'branch={{{{ branch }}}}' > {branch_path}"]diff --git a/tests/integration_tests/shell_wrapper.rs b/tests/integration_tests/shell_wrapper.rsindex f235bb59b..d9d75e522 100644--- a/tests/integration_tests/shell_wrapper.rs+++ b/tests/integration_tests/shell_wrapper.rs@@ -970,9 +970,7 @@ watch = "echo 'Watching for file changes'"// Pre-approve the commands in user configfs::write(repo.test_config_path(),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'Installing dependencies...'","echo 'Building project...'",@@ -1021,9 +1019,7 @@ test = "echo '✓ All 47 tests passed in 2.3s'"// Pre-approve commandsfs::write(repo.test_config_path(),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo '✓ Code formatting check passed'","echo '✓ Linting passed - no warnings'",@@ -1081,9 +1077,7 @@ test = "echo '✗ Test suite failed: 3 tests failing' && exit 1"// Pre-approve the commandsfs::write(repo.test_config_path(),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo '✓ Code formatting check passed'","echo '✗ Test suite failed: 3 tests failing' && exit 1",@@ -1151,7 +1145,7 @@ check2 = "{} check2 3"fs::write(repo.test_config_path(),format!(- r#"worktree-path = "../{{{{ main_worktree }}}}.{{{{ branch }}}}"+ r#"worktree-path = "../{{{{ repo }}}}.{{{{ branch }}}}"[projects."repo"]approved-commands = [@@ -1203,9 +1197,7 @@ approved-commands = [// Pre-approve the command in user configfs::write(repo.test_config_path(),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'test command executed'"]"#,)@@ -1348,9 +1340,7 @@ approved-commands = ["echo 'test command executed'"]// Pre-approve the command in user configfs::write(repo.test_config_path(),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'background task'"]"#,)@@ -1398,9 +1388,7 @@ approved-commands = ["echo 'background task'"]// Pre-approve the command in user configfs::write(repo.test_config_path(),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'fish background task'"]"#,)@@ -1614,9 +1602,7 @@ approved-commands = ["echo 'fish background task'"]// Pre-approve the commandfs::write(repo.test_config_path(),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'background job'"]"#,)@@ -1666,9 +1652,7 @@ approved-commands = ["echo 'background job'"]// Pre-approve the commandfs::write(repo.test_config_path(),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'bash background'"]"#,)@@ -2022,9 +2006,7 @@ approved-commands = ["echo 'bash background'"]// Pre-approve the commandfs::write(repo.test_config_path(),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]+ r#"[projects."repo"]approved-commands = ["echo 'cleanup test'"]"#,)diff --git a/tests/integration_tests/switch.rs b/tests/integration_tests/switch.rsindex 5e0fc2f66..f07a4d1fc 100644--- a/tests/integration_tests/switch.rs+++ b/tests/integration_tests/switch.rs@@ -309,7 +309,7 @@ fn test_switch_no_config_commands_skips_post_start_commands(repo: TestRepo) {fs::write(user_config_dir.join("config.toml"),format!(- r#"worktree-path = "../{{{{ main_worktree }}}}.{{{{ branch }}}}"+ r#"worktree-path = "../{{{{ repo }}}}.{{{{ branch }}}}"[projects."main"]approved-commands = ["{}"]diff --git a/tests/integration_tests/user_hooks.rs b/tests/integration_tests/user_hooks.rsindex 38355412b..03fb4dfd3 100644--- a/tests/integration_tests/user_hooks.rs+++ b/tests/integration_tests/user_hooks.rs@@ -36,9 +36,7 @@ fn snapshot_switch(test_name: &str, repo: &TestRepo, args: &[&str]) {fn test_user_post_create_hook_executes(repo: TestRepo) {// Write user config with post-create hook (no project config)repo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[post-create]+ r#"[post-create]log = "echo 'USER_POST_CREATE_RAN' > user_hook_marker.txt""#,);@@ -68,9 +66,7 @@ fn test_user_hooks_run_before_project_hooks(repo: TestRepo) {// Write user config with user hook AND pre-approve project commandrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[post-create]+ r#"[post-create]log = "echo 'USER_HOOK' >> hook_order.txt"[projects."repo"]@@ -98,9 +94,7 @@ fn test_user_hooks_no_approval_required(repo: TestRepo) {// Write user config with hook but NO pre-approved commands// (unlike project hooks, user hooks don't require approval)repo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[post-create]+ r#"[post-create]setup = "echo 'NO_APPROVAL_NEEDED' > no_approval.txt""#,);@@ -124,9 +118,7 @@ fn test_no_verify_flag_skips_all_hooks(repo: TestRepo) {// Write user config with both user hook and pre-approved project commandrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[post-create]+ r#"[post-create]log = "echo 'USER_HOOK' > user_marker.txt"[projects."repo"]@@ -162,9 +154,7 @@ approved-commands = ["echo 'PROJECT_HOOK' > project_marker.txt"]fn test_user_post_create_hook_failure(repo: TestRepo) {// Write user config with failing hookrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[post-create]+ r#"[post-create]failing = "exit 1""#,);@@ -188,9 +178,7 @@ failing = "exit 1"fn test_user_post_start_hook_executes(repo: TestRepo) {// Write user config with post-start hook (background)repo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[post-start]+ r#"[post-start]bg = "echo 'USER_POST_START_RAN' > user_bg_marker.txt""#,);@@ -213,9 +201,7 @@ bg = "echo 'USER_POST_START_RAN' > user_bg_marker.txt"fn test_user_post_start_skipped_with_no_verify(repo: TestRepo) {// Write user config with post-start hookrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[post-start]+ r#"[post-start]bg = "echo 'USER_BG' > user_bg_marker.txt""#,);@@ -258,9 +244,7 @@ fn test_user_pre_merge_hook_executes(mut repo: TestRepo) {// Write user config with pre-merge hookrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[pre-merge]+ r#"[pre-merge]check = "echo 'USER_PRE_MERGE_RAN' > user_premerge.txt""#,);@@ -285,9 +269,7 @@ fn test_user_pre_merge_hook_failure_blocks_merge(mut repo: TestRepo) {// Write user config with failing pre-merge hookrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[pre-merge]+ r#"[pre-merge]check = "exit 1""#,);@@ -309,9 +291,7 @@ fn test_user_pre_merge_skipped_with_no_verify(mut repo: TestRepo) {// Write user config with pre-merge hook that creates a markerrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[pre-merge]+ r#"[pre-merge]check = "echo 'USER_PRE_MERGE' > user_premerge_marker.txt""#,);@@ -469,9 +449,7 @@ fn test_user_post_merge_hook_executes(mut repo: TestRepo) {// Write user config with post-merge hookrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[post-merge]+ r#"[post-merge]notify = "echo 'USER_POST_MERGE_RAN' > user_postmerge.txt""#,);@@ -513,9 +491,7 @@ fn test_user_pre_remove_hook_executes(mut repo: TestRepo) {// Write user config with pre-remove hook// Hook writes to parent dir (temp dir) since the worktree itself gets removedrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[pre-remove]+ r#"[pre-remove]cleanup = "echo 'USER_PRE_REMOVE_RAN' > ../user_preremove_marker.txt""#,);@@ -543,9 +519,7 @@ fn test_user_pre_remove_failure_blocks_removal(mut repo: TestRepo) {// Write user config with failing pre-remove hookrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[pre-remove]+ r#"[pre-remove]block = "exit 1""#,);@@ -571,9 +545,7 @@ fn test_user_pre_remove_skipped_with_no_verify(mut repo: TestRepo) {// Write user config with pre-remove hook that would blockrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[pre-remove]+ r#"[pre-remove]block = "exit 1""#,);@@ -614,9 +586,7 @@ fn test_user_pre_commit_hook_executes(mut repo: TestRepo) {// Write user config with pre-commit hookrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[pre-commit]+ r#"[pre-commit]lint = "echo 'USER_PRE_COMMIT_RAN' > user_precommit.txt""#,);@@ -643,9 +613,7 @@ fn test_user_pre_commit_failure_blocks_commit(mut repo: TestRepo) {// Write user config with failing pre-commit hookrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[pre-commit]+ r#"[pre-commit]lint = "exit 1""#,);@@ -667,9 +635,7 @@ lint = "exit 1"fn test_user_hook_template_variables(repo: TestRepo) {// Write user config with hook using template variablesrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[post-create]+ r#"[post-create]vars = "echo 'repo={{ repo }} branch={{ branch }}' > template_vars.txt""#,);@@ -706,9 +672,7 @@ fn test_user_and_project_post_start_both_run(repo: TestRepo) {// Write user config with user hook AND pre-approve project commandrepo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[post-start]+ r#"[post-start]bg = "echo 'USER_POST_START' > user_bg.txt"[projects."repo"]diff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snapindex a180c18eb..2eebc6e41 100644--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap@@ -11,10 +11,10 @@ exit_code: 1[2m○[22m post-create [1mbranch[22m:[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Branch: {{ branch }}'[0m[2m[2m○[22m post-create [1mworktree[22m:-[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Worktree: {{ worktree }}'[0m[2m+[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Worktree: {{ worktree_path }}'[0m[2m[2m○[22m post-create [1mrepo[22m:-[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Repo: {{ main_worktree }}'[0m[2m+[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Repo: {{ repo }}'[0m[2m[2m○[22m post-create [1mpwd[22m:-[107m [0m [2m[0m[2m[34mcd[0m[2m {{ worktree }} [0m[2m[36m&&[0m[2m [0m[2m[34mpwd[0m[2m+[107m [0m [2m[0m[2m[34mcd[0m[2m {{ worktree_path }} [0m[2m[36m&&[0m[2m [0m[2m[34mpwd[0m[2m[31m✗[39m [31mCannot prompt for approval in non-interactive environment[39m[2m↳[22m [2mTo skip prompts in CI/CD, add [90m--yes[39m; to pre-approve commands, run [90mwt hook approvals add[39m[22mdiff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snapindex 44ddbc03f..7cf72d69e 100644--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap@@ -9,6 +9,6 @@ exit_code: 1[33m▲[39m [33m[1mrepo[22m needs approval to execute [1m1[22m command:[39m[2m○[22m post-create:-[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Worktree path: {{ worktree }}'[0m[2m+[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Worktree path: {{ worktree_path }}'[0m[2m[31m✗[39m [31mCannot prompt for approval in non-interactive environment[39m[2m↳[22m [2mTo skip prompts in CI/CD, add [90m--yes[39m; to pre-approve commands, run [90mwt hook approvals add[39m[22mdiff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_empty_project_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_empty_project_config.snapindex 0be0a02b5..10d8553aa 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_empty_project_config.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_empty_project_config.snap@@ -32,7 +32,7 @@ exit_code: 0----- stderr -----[36mUSER CONFIG[39m ~/.config/worktrunk/config.toml-[107m [0m worktree-path = [32m"../{{ main_worktree }}.{{ branch }}"+[107m [0m worktree-path = [32m"../{{ repo }}.{{ branch }}"[36mPROJECT CONFIG[39m _REPO_/.config/wt.toml[2m↳[22m [2mEmpty file[22mdiff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snapindex 5dd50d1c7..e6a47f751 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap@@ -33,7 +33,7 @@ exit_code: 0----- stderr -----[36mUSER CONFIG[39m ~/.config/worktrunk/config.toml-[107m [0m worktree-path = [32m"../{{ main_worktree }}.{{ branch }}"+[107m [0m worktree-path = [32m"../{{ repo }}.{{ branch }}"[107m [0m[107m [0m [1m[36m[commit-generation][107m [0m command = [32m"nonexistent-llm-command-12345"diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snapindex 01b247194..375cd7f9f 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap@@ -33,7 +33,7 @@ exit_code: 0----- stderr -----[36mUSER CONFIG[39m ~/.config/worktrunk/config.toml-[107m [0m worktree-path = [32m"../{{ main_worktree }}.{{ branch }}"+[107m [0m worktree-path = [32m"../{{ repo }}.{{ branch }}"[36mPROJECT CONFIG[39m _REPO_/.config/wt.toml[2m↳[22m [2mNot found[22mdiff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_github_remote.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_github_remote.snapindex 3664b0931..e9eabef19 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_github_remote.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_github_remote.snap@@ -32,7 +32,7 @@ exit_code: 0----- stderr -----[36mUSER CONFIG[39m ~/.config/worktrunk/config.toml-[107m [0m worktree-path = [32m"../{{ main_worktree }}.{{ branch }}"+[107m [0m worktree-path = [32m"../{{ repo }}.{{ branch }}"[36mPROJECT CONFIG[39m _REPO_/.config/wt.toml[2m↳[22m [2mNot found[22mdiff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_gitlab_remote.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_gitlab_remote.snapindex 3664b0931..e9eabef19 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_gitlab_remote.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_gitlab_remote.snap@@ -32,7 +32,7 @@ exit_code: 0----- stderr -----[36mUSER CONFIG[39m ~/.config/worktrunk/config.toml-[107m [0m worktree-path = [32m"../{{ main_worktree }}.{{ branch }}"+[107m [0m worktree-path = [32m"../{{ repo }}.{{ branch }}"[36mPROJECT CONFIG[39m _REPO_/.config/wt.toml[2m↳[22m [2mNot found[22mdiff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_no_project_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_no_project_config.snapindex 3664b0931..e9eabef19 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_no_project_config.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_no_project_config.snap@@ -32,7 +32,7 @@ exit_code: 0----- stderr -----[36mUSER CONFIG[39m ~/.config/worktrunk/config.toml-[107m [0m worktree-path = [32m"../{{ main_worktree }}.{{ branch }}"+[107m [0m worktree-path = [32m"../{{ repo }}.{{ branch }}"[36mPROJECT CONFIG[39m _REPO_/.config/wt.toml[2m↳[22m [2mNot found[22mdiff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_outside_git_repo.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_outside_git_repo.snapindex cc2e0c7ce..bfeddcd0d 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_outside_git_repo.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_outside_git_repo.snap@@ -25,7 +25,7 @@ exit_code: 0----- stderr -----[36mUSER CONFIG[39m ~/.config/worktrunk/config.toml-[107m [0m worktree-path = [32m"../{{ main_worktree }}.{{ branch }}"+[107m [0m worktree-path = [32m"../{{ repo }}.{{ branch }}"[2m[36mPROJECT CONFIG[39m Not in a git repository[22mdiff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_shell_integration_active.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_shell_integration_active.snapindex 1b3a9b694..ae5c53fad 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_shell_integration_active.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_shell_integration_active.snap@@ -33,7 +33,7 @@ exit_code: 0----- stderr -----[36mUSER CONFIG[39m ~/.config/worktrunk/config.toml-[107m [0m worktree-path = [32m"../{{ main_worktree }}.{{ branch }}"+[107m [0m worktree-path = [32m"../{{ repo }}.{{ branch }}"[36mPROJECT CONFIG[39m _REPO_/.config/wt.toml[2m↳[22m [2mNot found[22mdiff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_project_keys.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_project_keys.snapindex 3edc6d9fb..a1bc54b32 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_project_keys.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_project_keys.snap@@ -32,7 +32,7 @@ exit_code: 0----- stderr -----[36mUSER CONFIG[39m ~/.config/worktrunk/config.toml-[107m [0m worktree-path = [32m"../{{ main_worktree }}.{{ branch }}"+[107m [0m worktree-path = [32m"../{{ repo }}.{{ branch }}"[36mPROJECT CONFIG[39m _REPO_/.config/wt.toml[33m▲[39m [33mUnknown key [1mpost-merge-command[22m will be ignored[39mdiff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_user_keys.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_user_keys.snapindex 30979955d..5d1bf6f66 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_user_keys.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_user_keys.snap@@ -33,7 +33,7 @@ exit_code: 0----- stderr -----[36mUSER CONFIG[39m ~/.config/worktrunk/config.toml[33m▲[39m [33mUnknown key [1mcommit-gen[22m will be ignored[39m-[107m [0m worktree-path = [32m"../{{ main_worktree }}.{{ branch }}"+[107m [0m worktree-path = [32m"../{{ repo }}.{{ branch }}"[107m [0m[107m [0m [1m[36m[commit-gen][107m [0m command = [32m"llm"diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snapindex 0be0a02b5..10d8553aa 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap@@ -32,7 +32,7 @@ exit_code: 0----- stderr -----[36mUSER CONFIG[39m ~/.config/worktrunk/config.toml-[107m [0m worktree-path = [32m"../{{ main_worktree }}.{{ branch }}"+[107m [0m worktree-path = [32m"../{{ repo }}.{{ branch }}"[36mPROJECT CONFIG[39m _REPO_/.config/wt.toml[2m↳[22m [2mEmpty file[22mdiff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snapindex af2d94c64..29b0eeba5 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap@@ -32,7 +32,7 @@ exit_code: 0----- stderr -----[36mUSER CONFIG[39m ~/.config/worktrunk/config.toml-[107m [0m worktree-path = [32m"../{{ main_worktree }}.{{ branch }}"+[107m [0m worktree-path = [32m"../{{ repo }}.{{ branch }}"[107m [0m[107m [0m [1m[36m[projects."test-project"][107m [0m approved-commands = [[32m"npm install"[0m]diff --git a/tests/snapshots/integration__integration_tests__config_show__deprecated_template_variables_show_warning.snap b/tests/snapshots/integration__integration_tests__config_show__deprecated_template_variables_show_warning.snapnew file mode 100644index 000000000..736c7247e--- /dev/null+++ b/tests/snapshots/integration__integration_tests__config_show__deprecated_template_variables_show_warning.snap@@ -0,0 +1,38 @@+---+source: tests/integration_tests/config_show.rs+info:+ program: wt+ args:+ - list+ env:+ APPDATA: "[TEST_CONFIG_HOME]"+ CLICOLOR_FORCE: "1"+ COLUMNS: "150"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ GIT_TERMINAL_PROMPT: "0"+ HOME: "[TEST_HOME]"+ LANG: C+ LC_ALL: C+ PATH: "[PATH]"+ RUST_LOG: warn+ SOURCE_DATE_EPOCH: "1735776000"+ USERPROFILE: "[TEST_HOME]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"+---+success: true+exit_code: 0+----- stdout -----+ [1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage+@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit++[2m○[22m [2mShowing 1 worktree++----- stderr -----+[33m▲[39m [33mUser config uses deprecated template variables: [2mrepo_root[22m → [1mrepo_path[22m, [2mworktree[22m → [1mworktree_path[22m, [2mmain_worktree[22m → [1mrepo[22m[39m+[2m↳[22m [2mWrote migrated test-config.toml.new; to apply: [90mmv -- [TEST_CONFIG_NEW] [TEST_CONFIG][39m[22mdiff --git a/tests/snapshots/integration__integration_tests__help__help_config_create.snap b/tests/snapshots/integration__integration_tests__help__help_config_create.snapindex 5f27d74a8..88f3d983a 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_create.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_create.snap@@ -13,6 +13,7 @@ info:RUST_LOG: warnSOURCE_DATE_EPOCH: "1735776000"WORKTRUNK_CONFIG_PATH: /nonexistent/test/config.toml+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"---success: trueexit_code: 0@@ -246,10 +247,10 @@ With [2m--project[0m, creates [2m.config/wt.toml[0m in the current repositor[2m# developers working on the project.[2m[2m# Available template variables (all hooks):- [2m# {{ repo }} - Repository name (e.g., "my-project")- [2m# {{ branch }} - Raw branch name (e.g., "feature/foo")- [2m# {{ worktree }} - Absolute path to the worktree- [2m# {{ repo_root }} - Absolute path to the repository root+ [2m# {{ repo }} - Repository name (e.g., "my-project")+ [2m# {{ repo_path }} - Absolute path to repository (e.g., "/path/to/my-project")+ [2m# {{ branch }} - Raw branch name (e.g., "feature/foo")+ [2m# {{ worktree_path }} - Absolute path to worktree (e.g., "/path/to/my-project.feature-foo")[2m#[2m# Merge-related hooks also support:[2m# {{ target }} - Target branch for the merge (e.g., "main" default branch)diff --git a/tests/snapshots/integration__integration_tests__hook_show__hook_show_filter_by_type.snap b/tests/snapshots/integration__integration_tests__hook_show__hook_show_filter_by_type.snapindex 2b603969b..2762bdc39 100644--- a/tests/snapshots/integration__integration_tests__hook_show__hook_show_filter_by_type.snap+++ b/tests/snapshots/integration__integration_tests__hook_show__hook_show_filter_by_type.snap@@ -24,6 +24,7 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: true@@ -31,7 +32,7 @@ exit_code: 0----- stdout ---------- stderr ------[TEST_CONFIG]+[36mUSER HOOKS[39m [TEST_CONFIG][2m↳[22m [2m(none configured)[22m[36mPROJECT HOOKS[39m _REPO_/.config/wt.tomldiff --git a/tests/snapshots/integration__integration_tests__hook_show__hook_show_no_hooks.snap b/tests/snapshots/integration__integration_tests__hook_show__hook_show_no_hooks.snapindex 0a575ae3b..cebd68eea 100644--- a/tests/snapshots/integration__integration_tests__hook_show__hook_show_no_hooks.snap+++ b/tests/snapshots/integration__integration_tests__hook_show__hook_show_no_hooks.snap@@ -23,6 +23,7 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: true@@ -30,7 +31,7 @@ exit_code: 0----- stdout ---------- stderr ------[TEST_CONFIG]+[36mUSER HOOKS[39m [TEST_CONFIG][2m↳[22m [2m(none configured)[22m[36mPROJECT HOOKS[39m _REPO_/.config/wt.tomldiff --git a/tests/snapshots/integration__integration_tests__hook_show__hook_show_project_config_no_hooks.snap b/tests/snapshots/integration__integration_tests__hook_show__hook_show_project_config_no_hooks.snapindex 20ed77590..f2703567f 100644--- a/tests/snapshots/integration__integration_tests__hook_show__hook_show_project_config_no_hooks.snap+++ b/tests/snapshots/integration__integration_tests__hook_show__hook_show_project_config_no_hooks.snap@@ -23,6 +23,7 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: true@@ -30,7 +31,7 @@ exit_code: 0----- stdout ---------- stderr ------[TEST_CONFIG]+[36mUSER HOOKS[39m [TEST_CONFIG][2m↳[22m [2m(none configured)[22m[36mPROJECT HOOKS[39m _REPO_/.config/wt.tomldiff --git a/tests/snapshots/integration__integration_tests__hook_show__hook_show_with_both_configs.snap b/tests/snapshots/integration__integration_tests__hook_show__hook_show_with_both_configs.snapindex c0b3dcf11..45dd6b98a 100644--- a/tests/snapshots/integration__integration_tests__hook_show__hook_show_with_both_configs.snap+++ b/tests/snapshots/integration__integration_tests__hook_show__hook_show_with_both_configs.snap@@ -23,6 +23,7 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: true@@ -30,7 +31,7 @@ exit_code: 0----- stdout ---------- stderr ------[TEST_CONFIG]+[36mUSER HOOKS[39m [TEST_CONFIG][2m↳[22m [2m(none configured)[22m[36mPROJECT HOOKS[39m _REPO_/.config/wt.toml