Skip to content

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

Remove blank lines between command listings in approval prompts

Maximilian Roos14107f813987
diff --git a/src/commands/command_approval.rs b/src/commands/command_approval.rs
index 5d4ce8813..2f6a1be68 100644
--- a/src/commands/command_approval.rs
+++ b/src/commands/command_approval.rs
@@ -124,7 +124,6 @@ fn prompt_for_batch_approval(commands: &[&Command], project_id: &str) -> anyhow:
};
eprintln!("{label}");
eprint!("{}", format_bash_with_gutter(&cmd.expanded, ""));
- eprintln!();
}
// Check if stdin is a TTY before attempting to prompt
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_accept.snap b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_accept.snap
index 6405ec92b..cfb2f65f3 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_accept.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_accept.snap
@@ -8,7 +8,6 @@ y
⚪ post-create:
  echo 'test command'
-
❓ Allow and remember? [y/N]
🔄 Running project post-create:
  echo 'test command'
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_decline.snap b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_decline.snap
index 854cbf637..e85ae71f6 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_decline.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_decline.snap
@@ -8,7 +8,6 @@ n
⚪ post-create:
  echo 'test command'
-
❓ Allow and remember? [y/N]
⚪ Commands declined, continuing worktree creation
✅ Created new worktree for test-decline from main at [REPO]/repo.test-decline
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap
index 2ce98cd4d..132c64e82 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap
@@ -8,10 +8,8 @@ y
⚪ post-create first:
  echo 'First command'
-
⚪ post-create third:
  echo 'Third command'
-
❓ Allow and remember? [y/N]
🔄 Running project post-create first:
  echo 'First command'
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap
index 354ae6453..5c892b033 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap
@@ -8,10 +8,8 @@ n
⚪ post-create first:
  echo 'First command'
-
⚪ post-create third:
  echo 'Third command'
-
❓ Allow and remember? [y/N]
⚪ Commands declined, continuing worktree creation
✅ Created new worktree for test-mixed-decline from main at [REPO]/repo.test-mixed-decline
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap
index 079c27971..98d454f9c 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap
@@ -8,13 +8,10 @@ y
⚪ post-create first:
  echo 'First command'
-
⚪ post-create second:
  echo 'Second command'
-
⚪ post-create third:
  echo 'Third command'
-
❓ Allow and remember? [y/N]
🔄 Running project post-create first:
  echo 'First command'
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_named_commands.snap b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_named_commands.snap
index 703aa1899..3edb6c96a 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_named_commands.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_named_commands.snap
@@ -8,13 +8,10 @@ y
⚪ post-create install:
  echo 'Installing dependencies...'
-
⚪ post-create build:
  echo 'Building project...'
-
⚪ post-create test:
  echo 'Running tests...'
-
❓ Allow and remember? [y/N]
🔄 Running project post-create install:
  echo 'Installing dependencies...'
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_permission_error.snap b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_permission_error.snap
index c1c28be53..e99923648 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_permission_error.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_permission_error.snap
@@ -8,7 +8,6 @@ y
⚪ post-create:
  echo 'test command'
-
❓ Allow and remember? [y/N]
🟡 Failed to save command approval: Failed to write config file: Permission denied (os error 13)
💡 Approval will be requested again next time.
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_approval_prompt.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_approval_prompt.snap
index 5bf807737..80878f56f 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_approval_prompt.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_approval_prompt.snap
@@ -6,11 +6,8 @@ expression: prompt_only
⚪ post-create install:
echo 'Installing dependencies...'
-
⚪ post-create build:
echo 'Building project...'
-
⚪ post-create test:
echo 'Running tests...'
-
❓ Allow and remember? [y/N]
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_switch_back.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_switch_back.snap
index 9d1d0ded2..a00343b8a 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_switch_back.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_switch_back.snap
@@ -1,6 +1,5 @@
---
source: tests/integration_tests/shell_wrapper.rs
-assertion_line: 1339
expression: output.normalized()
---
✅ Switched to worktree for feature-api at [TMPDIR]/repo.feature-api
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_fails_in_non_tty.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_fails_in_non_tty.snap
index c8b3fec7b..4a44a942f 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_fails_in_non_tty.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_fails_in_non_tty.snap
@@ -28,7 +28,6 @@ exit_code: 1
⚪ post-create:
  echo 'test command'
-
❌ Cannot prompt for approval in non-interactive environment
💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use wt config approvals add
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap
index 076711c68..127cffb25 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap
@@ -10,10 +10,8 @@ exit_code: 1
⚪ post-create first:
  echo 'First command'
-
⚪ post-create third:
  echo 'Third command'
-
❌ Cannot prompt for approval in non-interactive environment
💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use wt config approvals add
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.snap
index c9d034f1e..871d8a752 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
@@ -10,16 +10,12 @@ exit_code: 1
⚪ post-create branch:
  echo 'Branch: test-nested-branch'
-
⚪ post-create worktree:
  echo 'Worktree: [REPO].test-nested-branch'
-
⚪ post-create repo:
  echo 'Repo: repo'
-
⚪ post-create pwd:
  cd [REPO].test-nested-branch && pwd
-
❌ Cannot prompt for approval in non-interactive environment
💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use wt config approvals add
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap
index 7f345ab0c..df0ae93f9 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap
@@ -10,13 +10,10 @@ exit_code: 1
⚪ post-create install:
  echo 'Installing dependencies...'
-
⚪ post-create build:
  echo 'Building project...'
-
⚪ post-create test:
  echo 'Running tests...'
-
❌ Cannot prompt for approval in non-interactive environment
💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use wt config approvals add
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap
index 814bb9496..5897426a0 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
@@ -10,7 +10,6 @@ exit_code: 1
⚪ post-create:
  echo 'Worktree path: [REPO].feature-test-approval'
-
❌ Cannot prompt for approval in non-interactive environment
💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use wt config approvals add
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap b/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap
index 076711c68..127cffb25 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap
@@ -10,10 +10,8 @@ exit_code: 1
⚪ post-create first:
  echo 'First command'
-
⚪ post-create third:
  echo 'Third command'
-
❌ Cannot prompt for approval in non-interactive environment
💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use wt config approvals add
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snap b/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snap
index 675d0b547..3e79ad0cd 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snap
@@ -10,7 +10,6 @@ exit_code: 1
⚪ post-create:
  echo 'test command' > output.txt
-
❌ Cannot prompt for approval in non-interactive environment
💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use wt config approvals add
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__run_hook_post_merge_requires_approval.snap b/tests/snapshots/integration__integration_tests__approval_ui__run_hook_post_merge_requires_approval.snap
index fe388ddd5..c9abbe748 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__run_hook_post_merge_requires_approval.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__run_hook_post_merge_requires_approval.snap
@@ -10,7 +10,6 @@ exit_code: 1
⚪ post-merge:
  echo 'Post-merge cleanup for main'
-
❌ Cannot prompt for approval in non-interactive environment
💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use wt config approvals add
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__run_hook_pre_merge_requires_approval.snap b/tests/snapshots/integration__integration_tests__approval_ui__run_hook_pre_merge_requires_approval.snap
index 92ebf669b..e2dc71126 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__run_hook_pre_merge_requires_approval.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__run_hook_pre_merge_requires_approval.snap
@@ -10,7 +10,6 @@ exit_code: 1
⚪ pre-merge:
  echo 'Running pre-merge checks on main'
-
❌ Cannot prompt for approval in non-interactive environment
💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use wt config approvals add
diff --git a/tests/snapshots/integration__integration_tests__approvals__add_approvals_all_none_approved.snap b/tests/snapshots/integration__integration_tests__approvals__add_approvals_all_none_approved.snap
index 3e490b44e..28a0e316e 100644
--- a/tests/snapshots/integration__integration_tests__approvals__add_approvals_all_none_approved.snap
+++ b/tests/snapshots/integration__integration_tests__approvals__add_approvals_all_none_approved.snap
@@ -29,7 +29,6 @@ exit_code: 1
⚪ post-create:
  echo 'test'
-
❌ Cannot prompt for approval in non-interactive environment
💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use wt config approvals add
diff --git a/tests/snapshots/integration__integration_tests__approvals__add_approvals_force.snap b/tests/snapshots/integration__integration_tests__approvals__add_approvals_force.snap
deleted file mode 100644
index dc45983a7..000000000
--- a/tests/snapshots/integration__integration_tests__approvals__add_approvals_force.snap
+++ /dev/null
@@ -1,28 +0,0 @@
----
-source: tests/integration_tests/approvals.rs
-info:
- program: wt
- args:
- - config
- - approvals
- - add
- - "--force"
- env:
- 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: ""
- LANG: C
- LC_ALL: C
- SOURCE_DATE_EPOCH: "1735776000"
- WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
----
-success: true
-exit_code: 0
------ stdout -----
-
------ stderr -----
-✅ Commands approved; not saved (--force)
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap
deleted file mode 100644
index bae3d43a1..000000000
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap
+++ /dev/null
@@ -1,35 +0,0 @@
----
-source: tests/integration_tests/post_start_commands.rs
-info:
- program: wt
- args:
- - switch
- - "--create"
- - feature
- env:
- 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: ""
- HOME: "[TEST_HOME]"
- LANG: C
- LC_ALL: C
- SOURCE_DATE_EPOCH: "1735776000"
- WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
----
-success: true
-exit_code: 0
------ stdout -----
-
------ stderr -----
-🔄 Running post-create:
-  echo 'First'
-First
-🔄 Running post-create:
-  echo 'Second'
-Second
-✅ Created new worktree for feature from main at [REPO].feature
-💡 Run wt config shell install to enable automatic cd
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__no_user_hooks_flag.snap b/tests/snapshots/integration__integration_tests__user_hooks__no_user_hooks_flag.snap
deleted file mode 100644
index eded8f916..000000000
--- a/tests/snapshots/integration__integration_tests__user_hooks__no_user_hooks_flag.snap
+++ /dev/null
@@ -1,34 +0,0 @@
----
-source: tests/integration_tests/user_hooks.rs
-info:
- program: wt
- args:
- - switch
- - "--create"
- - feature
- - "--no-user-hooks"
- env:
- 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: ""
- LANG: C
- LC_ALL: C
- SOURCE_DATE_EPOCH: "1735776000"
- WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
----
-success: false
-exit_code: 2
------ stdout -----
-
------ stderr -----
-error: unexpected argument '--no-user-hooks' found
-
- tip: to pass '--no-user-hooks' as a value, use '-- --no-user-hooks'
-
-Usage: wt switch --create <BRANCH>
-
-For more information, try '--help'.
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_skipped.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_skipped.snap
deleted file mode 100644
index eded8f916..000000000
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_skipped.snap
+++ /dev/null
@@ -1,34 +0,0 @@
----
-source: tests/integration_tests/user_hooks.rs
-info:
- program: wt
- args:
- - switch
- - "--create"
- - feature
- - "--no-user-hooks"
- env:
- 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: ""
- LANG: C
- LC_ALL: C
- SOURCE_DATE_EPOCH: "1735776000"
- WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
----
-success: false
-exit_code: 2
------ stdout -----
-
------ stderr -----
-error: unexpected argument '--no-user-hooks' found
-
- tip: to pass '--no-user-hooks' as a value, use '-- --no-user-hooks'
-
-Usage: wt switch --create <BRANCH>
-
-For more information, try '--help'.
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_merge_skipped.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_pre_merge_skipped.snap
deleted file mode 100644
index f1b3acfe3..000000000
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_merge_skipped.snap
+++ /dev/null
@@ -1,35 +0,0 @@
----
-source: tests/integration_tests/user_hooks.rs
-info:
- program: wt
- args:
- - merge
- - main
- - "--force"
- - "--no-remove"
- - "--no-user-hooks"
- env:
- 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: ""
- LANG: C
- LC_ALL: C
- SOURCE_DATE_EPOCH: "1735776000"
- WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
----
-success: false
-exit_code: 2
------ stdout -----
-
------ stderr -----
-error: unexpected argument '--no-user-hooks' found
-
- tip: to pass '--no-user-hooks' as a value, use '-- --no-user-hooks'
-
-Usage: wt merge --force --no-remove <TARGET>
-
-For more information, try '--help'.
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_remove_skipped.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_pre_remove_skipped.snap
deleted file mode 100644
index 68e54b5c5..000000000
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_remove_skipped.snap
+++ /dev/null
@@ -1,34 +0,0 @@
----
-source: tests/integration_tests/user_hooks.rs
-info:
- program: wt
- args:
- - remove
- - feature
- - "--force-delete"
- - "--no-user-hooks"
- env:
- 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: ""
- LANG: C
- LC_ALL: C
- SOURCE_DATE_EPOCH: "1735776000"
- WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
----
-success: false
-exit_code: 2
------ stdout -----
-
------ stderr -----
-error: unexpected argument '--no-user-hooks' found
-
- tip: to pass '--no-user-hooks' as a value, use '-- --no-user-hooks'
-
-Usage: wt remove --force-delete <WORKTREES>...
-
-For more information, try '--help'.