Skip to content

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

Unify the last two deprecation warnings to the standard pattern (#2153)

Maximilian Roos01f6082b0694
diff --git a/src/config/deprecation.rs b/src/config/deprecation.rs
index 3b58a5944..9ea5a5953 100644
--- a/src/config/deprecation.rs
+++ b/src/config/deprecation.rs
@@ -1367,20 +1367,13 @@ pub fn format_deprecation_warnings(info: &DeprecationInfo) -> String {
use std::fmt::Write;
let mut out = String::new();
- if !info.deprecations.vars.is_empty() {
- let var_list: Vec<String> = info
- .deprecations
- .vars
- .iter()
- .map(|(old, new)| cformat!("<dim>{}</> → <bold>{}</>", old, new))
- .collect();
+ for (old, new) in &info.deprecations.vars {
let _ = writeln!(
out,
"{}",
- warning_message(format!(
- "{} uses deprecated template variables: {}",
- info.label,
- var_list.join(", ")
+ warning_message(cformat!(
+ "{label}: template variable <bold>{old}</> is deprecated in favor of <bold>{new}</>",
+ label = info.label,
))
);
}
@@ -1411,8 +1404,8 @@ pub fn format_deprecation_warnings(info: &DeprecationInfo) -> String {
let _ = writeln!(
out,
"{}",
- warning_message(format!(
- "{} has approved-commands in [projects] sections (moved to approvals.toml)",
+ warning_message(cformat!(
+ "{}: <bold>approved-commands</> under <bold>[projects]</> is deprecated in favor of <bold>approvals.toml</>",
info.label
))
);
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap
index f6ebd9f38..f7a98d10f 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap
@@ -48,7 +48,7 @@ exit_code: 0
↳ Not found; to create one, run wt config create
PROJECT CONFIG @ _REPO_/.config/wt.toml
-▲ Project config uses deprecated template variables: main_worktree → repo
+▲ Project config: template variable main_worktree is deprecated in favor of repo
▲ Project config: post-create hook is deprecated in favor of pre-start
↳ To apply: wt config update
○ Proposed diff:
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap
index af092f99d..53899e278 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap
@@ -45,7 +45,8 @@ exit_code: 0
----- stderr -----
USER CONFIG @ ~/.config/worktrunk/config.toml
-▲ User config uses deprecated template variables: repo_root → repo_path, main_worktree → repo
+▲ User config: template variable repo_root is deprecated in favor of repo_path
+▲ User config: template variable main_worktree is deprecated in favor of repo
▲ User config: post-create hook is deprecated in favor of pre-start
↳ To apply: wt config update
○ Proposed diff:
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap
index 82c1e044a..487c204ee 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap
@@ -48,7 +48,7 @@ exit_code: 0
↳ Not found; to create one, run wt config create
PROJECT CONFIG @ [PROJECT_ID]
-▲ Project config uses deprecated template variables: main_worktree → repo
+▲ Project config: template variable main_worktree is deprecated in favor of repo
▲ Project config: post-create hook is deprecated in favor of pre-start
↳ To apply: wt -C _REPO_ config update
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_approved_commands_migration.snap b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_approved_commands_migration.snap
index d7c7c057d..06d03d93d 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_approved_commands_migration.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_approved_commands_migration.snap
@@ -45,7 +45,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-▲ User config has approved-commands in [projects] sections (moved to approvals.toml)
+▲ User config: approved-commands under [projects] is deprecated in favor of approvals.toml
↳ Copied approved commands to approvals.toml
○ Proposed diff:
  diff --git a[TEST_CONFIG] b[TEST_CONFIG_NEW]
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_template_var_migration.snap b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_template_var_migration.snap
index a7ddcb203..408b0db63 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_template_var_migration.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_template_var_migration.snap
@@ -45,7 +45,9 @@ exit_code: 0
----- stdout -----
----- stderr -----
-▲ User config uses deprecated template variables: repo_root → repo_path, worktree → worktree_path, main_worktree → repo
+▲ User config: template variable repo_root is deprecated in favor of repo_path
+▲ User config: template variable worktree is deprecated in favor of worktree_path
+▲ User config: template variable main_worktree is deprecated in favor of repo
▲ User config: post-create hook is deprecated in favor of pre-start
○ Proposed diff:
  diff --git a[TEST_CONFIG] b[TEST_CONFIG_NEW]
diff --git a/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_accept.snap b/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_accept.snap
index 2a37955b1..22e0b81dd 100644
--- a/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_accept.snap
+++ b/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_accept.snap
@@ -2,7 +2,8 @@
source: tests/integration_tests/config_update_pty.rs
expression: "&output"
---
-▲ User config uses deprecated template variables: repo_root → repo_path, main_worktree → repo
+▲ User config: template variable repo_root is deprecated in favor of repo_path
+▲ User config: template variable main_worktree is deprecated in favor of repo
▲ User config: post-create hook is deprecated in favor of pre-start
○ Proposed diff:
  diff --git a[TEST_CONFIG] b[TEST_CONFIG_NEW]
diff --git a/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_decline.snap b/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_decline.snap
index b10d3defa..27336407a 100644
--- a/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_decline.snap
+++ b/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_decline.snap
@@ -2,7 +2,8 @@
source: tests/integration_tests/config_update_pty.rs
expression: "&output"
---
-▲ User config uses deprecated template variables: repo_root → repo_path, main_worktree → repo
+▲ User config: template variable repo_root is deprecated in favor of repo_path
+▲ User config: template variable main_worktree is deprecated in favor of repo
▲ User config: post-create hook is deprecated in favor of pre-start
○ Proposed diff:
  diff --git a[TEST_CONFIG] b[TEST_CONFIG_NEW]