Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Refactor: Standardize CLI output styling with `anstyle`
Maximilian Roosefe9211aa447
diff --git a/CLAUDE.md b/CLAUDE.mdnew file mode 100644index 000000000..922905f08--- /dev/null+++ b/CLAUDE.md@@ -0,0 +1,165 @@+# Worktrunk Development Guidelines++> **Note**: This CLAUDE.md is just getting started. More guidelines will be added as patterns emerge.++## CLI Output Formatting Standards++### The anstyle Ecosystem++All styling uses the **anstyle ecosystem** for composable, auto-detecting terminal output:++- **`anstream`**: Auto-detecting I/O streams (println!, eprintln! macros)+- **`anstyle`**: Core styling with inline pattern `{style}text{style:#}`+- **Color detection**: Respects NO_COLOR, CLICOLOR_FORCE, TTY detection++### Message Types++Three canonical message patterns with their emojis:++1. **Errors**: β + red text+2. **Warnings**: π‘ + yellow text+3. **Hints**: π‘ + dimmed text++### Semantic Style Constants++**Constants defined in `src/styling.rs`:**++- **`ERROR`**: Red (errors, conflicts)+- **`WARNING`**: Yellow (warnings)+- **`SUCCESS`**: Green (success)+- **`HINT`**: Dimmed (hints, secondary information)+- **`CURRENT`**: Magenta + bold (current worktree)+- **`ADDITION`**: Green (diffs, additions)+- **`DELETION`**: Red (diffs, deletions)++### Inline Formatting Pattern++Use anstyle's inline pattern `{style}text{style:#}` where `#` means reset:++```rust+use worktrunk::styling::{eprintln, ERROR, WARNING, HINT};++// Simple error+eprintln!("β {ERROR}Working tree has uncommitted changes{ERROR:#}");++// Warning+eprintln!("π‘ {WARNING}Uncommitted changes detected{WARNING:#}");++// Hint+println!("π‘ {HINT}Use 'wt list' to see all worktrees{HINT:#}");+```++### Composing Styles++Compose styles using anstyle methods (`.bold()`, `.fg_color()`, etc.):++```rust+use worktrunk::styling::{eprintln, AnstyleStyle, ERROR, WARNING};++// Error with bold branch name+let error_bold = ERROR.bold();+eprintln!("β Branch '{error_bold}{branch}{error_bold:#}' already exists");++// Warning with bold+let warning_bold = WARNING.bold();+eprintln!("π‘ {warning_bold}{message}{warning_bold:#}");++// Just bold (no color)+let bold = AnstyleStyle::new().bold();+println!("Switched to worktree: {bold}{branch}{bold:#}");+```++### Branch Name Formatting++**Always format branch names in bold** when they appear in messages:++```rust+use worktrunk::styling::{AnstyleStyle, ERROR};++// Good - bold branch name in error+let error_bold = ERROR.bold();+eprintln!("β Branch '{error_bold}{branch}{error_bold:#}' already exists");++// Good - bold in regular message+let bold = AnstyleStyle::new().bold();+println!("Switched to worktree: {bold}{branch}{bold:#}");++// Bad - plain branch name+println!("Switched to worktree: {branch}")+```++### Color Detection++Colors automatically adjust based on environment:+- Respects `NO_COLOR` (disables)+- Respects `CLICOLOR_FORCE` / `FORCE_COLOR` (enables)+- Auto-detects TTY (colors only on terminals)++All handled automatically by `anstream` macros.++### Design Principles++- **Inline over wrappers** - Use `{style}text{style:#}` pattern, not wrapper functions+- **Composition over special cases** - Use `.bold()`, `.fg_color()`, not `format_X_with_Y()`+- **Semantic constants** - Use `ERROR`, `WARNING`, not raw colors+- **YAGNI for presentation** - Most output needs no styling+- **Minimal output** - Only use formatting where it adds clarity+- **Unicode-aware** - Width calculations respect emoji and CJK characters (via `StyledLine`)+- **Graceful degradation** - Must work without color support++### Complete Examples++```rust+use worktrunk::styling::{println, eprintln, AnstyleStyle, ERROR, WARNING, HINT, SUCCESS};+use anstyle::Style;++// Simple error+eprintln!("β {ERROR}Working tree has uncommitted changes{ERROR:#}");++// Error with bold branch name+let error_bold = ERROR.bold();+eprintln!("β Branch '{error_bold}{branch}{error_bold:#}' already exists");++// Warning with bold+let warning_bold = WARNING.bold();+eprintln!("π‘ {warning_bold}Uncommitted changes detected{warning_bold:#}");++// Hint+println!("π‘ {HINT}Use 'wt list' to see all worktrees{HINT:#}");++// Success message+println!("β {SUCCESS}Worktree created successfully{SUCCESS:#}");++// Bold branch name in regular message+let bold = Style::new().bold();+println!("Switched to worktree: {bold}{branch}{bold:#}");++// Complex multi-part error+let error_bold = ERROR.bold();+eprintln!("β Not a fast-forward from '{error_bold}{target_branch}{error_bold:#}' to HEAD");++// Dimmed secondary info+let dim = Style::new().dimmed();+println!(" {dim}Path: {path}{dim:#}");+```++### StyledLine API++For complex table formatting with proper width calculations, use `StyledLine`:++```rust+use worktrunk::styling::StyledLine;+use anstyle::{AnsiColor, Color, Style};++let mut line = StyledLine::new();+let dim = Style::new().dimmed();+let cyan = Style::new().fg_color(Some(Color::Ansi(AnsiColor::Cyan)));++line.push_styled("Branch", dim);+line.push_raw(" ");+line.push_styled("main", cyan);++println!("{}", line.render());+```++See `src/commands/list/render.rs` for advanced usage.diff --git a/src/commands/list/mod.rs b/src/commands/list/mod.rsindex 1ccb85f3d..d0f42548f 100644--- a/src/commands/list/mod.rs+++ b/src/commands/list/mod.rs@@ -6,6 +6,7 @@ mod spacing_test;use rayon::prelude::*;use worktrunk::git::{GitError, Repository};+use worktrunk::styling::{WARNING, eprintln};use layout::calculate_responsive_layout;use render::{format_header_line, format_list_item_line};@@ -321,7 +322,12 @@ pub fn handle_list(format: crate::OutputFormat, show_branches: bool) -> Result<(for branch in available_branches {match BranchInfo::from_branch(&branch, &repo, primary_branch) {Ok(branch_info) => items.push(ListItem::Branch(branch_info)),- Err(e) => eprintln!("Warning: Failed to enrich branch '{}': {}", branch, e),+ Err(e) => {+ let warning_bold = WARNING.bold();+ eprintln!(+ "π‘ Failed to enrich branch {warning_bold}{branch}{warning_bold:#}: {e}"+ );+ }}}}diff --git a/src/commands/list/render.rs b/src/commands/list/render.rsindex a7a147837..64c44d0c7 100644--- a/src/commands/list/render.rs+++ b/src/commands/list/render.rs@@ -1,8 +1,6 @@use crate::display::{format_relative_time, shorten_path, truncate_at_word_boundary};-use worktrunk::styling::{- StyledLine, addition_style, current_style, deletion_style, dim_style, neutral_style,- primary_style,-};+use anstyle::{AnsiColor, Color, Style};+use worktrunk::styling::{ADDITION, CURRENT, DELETION, StyledLine};use super::layout::LayoutConfig;use super::{ListItem, WorktreeInfo};@@ -43,68 +41,67 @@ pub fn format_all_states(info: &WorktreeInfo) -> String {pub fn format_header_line(layout: &LayoutConfig) {let widths = &layout.widths;let mut line = StyledLine::new();- let dim = dim_style();// Branchlet header = format!("{:width$}", "Branch", width = widths.branch);- line.push_styled(header, dim);+ line.push_styled(header, Style::new().dimmed());line.push_raw(" ");// Age (Time)if widths.time > 0 {let header = format!("{:width$}", "Age", width = widths.time);- line.push_styled(header, dim);+ line.push_styled(header, Style::new().dimmed());line.push_raw(" ");}// Ahead/behind (commits)if widths.ahead_behind > 0 {let header = format!("{:width$}", "Cmts", width = widths.ahead_behind);- line.push_styled(header, dim);+ line.push_styled(header, Style::new().dimmed());line.push_raw(" ");}// Branch diff (line diff in commits)if widths.branch_diff.total > 0 {let header = format!("{:width$}", "Cmt +/-", width = widths.branch_diff.total);- line.push_styled(header, dim);+ line.push_styled(header, Style::new().dimmed());line.push_raw(" ");}// Working tree diffif widths.working_diff.total > 0 {let header = format!("{:width$}", "WT +/-", width = widths.working_diff.total);- line.push_styled(header, dim);+ line.push_styled(header, Style::new().dimmed());line.push_raw(" ");}// Upstreamif widths.upstream > 0 {let header = format!("{:width$}", "Remote", width = widths.upstream);- line.push_styled(header, dim);+ line.push_styled(header, Style::new().dimmed());line.push_raw(" ");}// Commit (fixed width: 8 chars)- line.push_styled("Commit ", dim);+ line.push_styled("Commit ", Style::new().dimmed());line.push_raw(" ");// Messageif widths.message > 0 {let header = format!("{:width$}", "Message", width = widths.message);- line.push_styled(header, dim);+ line.push_styled(header, Style::new().dimmed());line.push_raw(" ");}// Statesif widths.states > 0 {let header = format!("{:width$}", "State", width = widths.states);- line.push_styled(header, dim);+ line.push_styled(header, Style::new().dimmed());line.push_raw(" ");}// Path- line.push_styled("Path", dim);+ line.push_styled("Path", Style::new().dimmed());println!("{}", line.render());}@@ -124,12 +121,6 @@ fn format_item_line(current_worktree_path: Option<&std::path::PathBuf>,) {let widths = &layout.widths;- let primary = primary_style();- let current = current_style();- let green = addition_style();- let red = deletion_style();- let yellow = neutral_style();- let dim = dim_style();let short_head = &item.commit_head()[..8.min(item.commit_head().len())];@@ -139,8 +130,8 @@ fn format_item_line(.map(|p| p == &info.worktree.path).unwrap_or(false);match (is_current, item.is_primary()) {- (true, _) => Some(current),- (_, true) => Some(primary),+ (true, _) => Some(CURRENT),+ (_, true) => Some(Style::new().fg_color(Some(Color::Ansi(AnsiColor::Cyan)))),_ => None,}});@@ -164,7 +155,7 @@ fn format_item_line(format_relative_time(item.timestamp()),width = widths.time);- line.push_styled(time_str, dim);+ line.push_styled(time_str, Style::new().dimmed());line.push_raw(" ");}@@ -176,7 +167,10 @@ fn format_item_line(format!("β{} β{}", item.ahead(), item.behind()),width = widths.ahead_behind);- line.push_styled(ahead_behind_text, yellow);+ line.push_styled(+ ahead_behind_text,+ Style::new().fg_color(Some(Color::Ansi(AnsiColor::Yellow))),+ );} else {line.push_raw(" ".repeat(widths.ahead_behind));}@@ -199,8 +193,8 @@ fn format_item_line(let mut diff_segment = StyledLine::new();// Split at the space between + and -let split_pos = 1 + widths.branch_diff.added_digits;- diff_segment.push_styled(&formatted[..split_pos], green);- diff_segment.push_styled(&formatted[split_pos..], red);+ diff_segment.push_styled(&formatted[..split_pos], ADDITION);+ diff_segment.push_styled(&formatted[split_pos..], DELETION);for segment in diff_segment.segments {line.push(segment);}@@ -228,8 +222,8 @@ fn format_item_line(let mut diff_segment = StyledLine::new();// Split at the space between + and -let split_pos = 1 + widths.working_diff.added_digits;- diff_segment.push_styled(&formatted[..split_pos], green);- diff_segment.push_styled(&formatted[split_pos..], red);+ diff_segment.push_styled(&formatted[..split_pos], ADDITION);+ diff_segment.push_styled(&formatted[split_pos..], DELETION);for segment in diff_segment.segments {line.push(segment);}@@ -246,11 +240,11 @@ fn format_item_line(if widths.upstream > 0 {if let Some((remote_name, upstream_ahead, upstream_behind)) = item.upstream_info() {let mut upstream_segment = StyledLine::new();- upstream_segment.push_styled(remote_name, dim);+ upstream_segment.push_styled(remote_name, Style::new().dimmed());upstream_segment.push_raw(" ");- upstream_segment.push_styled(format!("β{}", upstream_ahead), green);+ upstream_segment.push_styled(format!("β{}", upstream_ahead), ADDITION);upstream_segment.push_raw(" ");- upstream_segment.push_styled(format!("β{}", upstream_behind), red);+ upstream_segment.push_styled(format!("β{}", upstream_behind), DELETION);upstream_segment.pad_to(widths.upstream);for segment in upstream_segment.segments {line.push(segment);@@ -265,7 +259,7 @@ fn format_item_line(if let Some(style) = text_style {line.push_styled(short_head, style);} else {- line.push_styled(short_head, dim);+ line.push_styled(short_head, Style::new().dimmed());}line.push_raw(" ");@@ -276,7 +270,7 @@ fn format_item_line(truncate_at_word_boundary(item.commit_message(), layout.max_message_len),width = widths.message);- line.push_styled(msg, dim);+ line.push_styled(msg, Style::new().dimmed());line.push_raw(" ");}diff --git a/src/commands/list/spacing_test.rs b/src/commands/list/spacing_test.rsindex 644bb0414..589bf3c94 100644--- a/src/commands/list/spacing_test.rs+++ b/src/commands/list/spacing_test.rs@@ -3,22 +3,21 @@//! This test verifies that header and data rows align properly,//! regardless of whether cells have ANSI styling applied.-use worktrunk::styling::{StyledLine, dim_style, primary_style};+use anstyle::{AnsiColor, Color, Style};+use worktrunk::styling::StyledLine;#[test]fn test_header_data_alignment_with_and_without_styling() {// Simulate what happens in the actual rendering- let dim = dim_style();- let primary = primary_style();// Header (always styled with dim)let mut header = StyledLine::new();let branch_width = 6;let branch_header = format!("{:width$}", "Branch", width = branch_width);- header.push_styled(branch_header, dim);+ header.push_styled(branch_header, Style::new().dimmed());header.push_raw(" "); // separatorlet age_header = format!("{:width$}", "Age", width = 14);- header.push_styled(age_header, dim);+ header.push_styled(age_header, Style::new().dimmed());println!("Header visual: |{}|",@@ -28,10 +27,13 @@ fn test_header_data_alignment_with_and_without_styling() {// Data row 1: with styling (styled cell)let mut row1 = StyledLine::new();let branch1_text = format!("{:width$}", "main", width = branch_width);- row1.push_styled(branch1_text.clone(), primary); // Styled+ row1.push_styled(+ branch1_text.clone(),+ Style::new().fg_color(Some(Color::Ansi(AnsiColor::Cyan))),+ ); // Styledrow1.push_raw(" "); // separatorlet time1_text = format!("{:width$}", "23 minutes ago", width = 14);- row1.push_styled(time1_text, dim);+ row1.push_styled(time1_text, Style::new().dimmed());println!("Row 1 styled visual: |{}|",@@ -49,7 +51,7 @@ fn test_header_data_alignment_with_and_without_styling() {row2.push_raw(branch2_text.clone()); // NOT styledrow2.push_raw(" "); // separatorlet time2_text = format!("{:width$}", "23 minutes ago", width = 14);- row2.push_styled(time2_text, dim);+ row2.push_styled(time2_text, Style::new().dimmed());println!("Row 2 unstyled visual: |{}|",diff --git a/src/commands/merge.rs b/src/commands/merge.rsindex 7e70d8418..538140ab9 100644--- a/src/commands/merge.rs+++ b/src/commands/merge.rs@@ -1,6 +1,6 @@use worktrunk::config::WorktrunkConfig;use worktrunk::git::{GitError, Repository};-use worktrunk::styling::format_error;+use worktrunk::styling::{AnstyleStyle, ERROR, println};use super::worktree::handle_push;use super::worktree::handle_remove;@@ -14,16 +14,19 @@ pub fn handle_merge(let repo = Repository::current();// Get current branch- let current_branch = repo- .current_branch()?- .ok_or_else(|| GitError::CommandFailed(format_error("Not on a branch (detached HEAD)")))?;+ let current_branch = repo.current_branch()?.ok_or_else(|| {+ GitError::CommandFailed(format!(+ "β {ERROR}Not on a branch (detached HEAD){ERROR:#}"+ ))+ })?;// Get target branch (default to default branch if not provided)let target_branch = target.map_or_else(|| repo.default_branch(), |b| Ok(b.to_string()))?;// Check if already on target branchif current_branch == target_branch {- println!("Already on '{}', nothing to merge", target_branch);+ let bold = AnstyleStyle::new().bold();+ println!("Already on {bold}{target_branch}{bold:#}, nothing to merge");return Ok(());}@@ -36,14 +39,15 @@ pub fn handle_merge(}// Rebase onto target- println!("Rebasing onto '{}'...", target_branch);+ let bold = AnstyleStyle::new().bold();+ println!("Rebasing onto {bold}{target_branch}{bold:#}...");repo.run_command(&["rebase", &target_branch]).map_err(|e| {GitError::CommandFailed(format!("Failed to rebase onto '{}': {}", target_branch, e))})?;// Fast-forward push to target branch (reuse handle_push logic)- println!("Fast-forwarding '{}' to current HEAD...", target_branch);+ println!("Fast-forwarding {bold}{target_branch}{bold:#} to current HEAD...");handle_push(Some(&target_branch), false)?;// Finish worktree unless --keep was specified@@ -68,7 +72,8 @@ pub fn handle_merge(let primary_repo = Repository::at(&primary_worktree_dir);let new_branch = primary_repo.current_branch()?;if new_branch.as_deref() != Some(&target_branch) {- println!("Switching to '{}'...", target_branch);+ let bold = AnstyleStyle::new().bold();+ println!("Switching to {bold}{target_branch}{bold:#}...");primary_repo.run_command(&["switch", &target_branch]).map_err(|e| {@@ -79,10 +84,8 @@ pub fn handle_merge(})?;}} else {- println!(- "Successfully merged to '{}' (worktree preserved)",- target_branch- );+ let bold = AnstyleStyle::new().bold();+ println!("Successfully merged to {bold}{target_branch}{bold:#} (worktree preserved)");}Ok(())@@ -109,17 +112,15 @@ fn handle_squash(target_branch: &str) -> Result<(), GitError> {if commit_count == 0 && has_staged {// Just staged changes, no commits - would need to commit but this shouldn't happen in merge flow- return Err(GitError::CommandFailed(format_error(- "Staged changes without commits - please commit them first",+ return Err(GitError::CommandFailed(format!(+ "β {ERROR}Staged changes without commits - please commit them first{ERROR:#}")));}if commit_count == 1 && !has_staged {// Single commit, no staged changes - nothing to do- println!(- "Only 1 commit since '{}' - no squashing needed",- target_branch- );+ let bold = AnstyleStyle::new().bold();+ println!("Only 1 commit since {bold}{target_branch}{bold:#} - no squashing needed");return Ok(());}diff --git a/src/commands/worktree.rs b/src/commands/worktree.rsindex fd08736dd..ad5f82186 100644--- a/src/commands/worktree.rs+++ b/src/commands/worktree.rs@@ -71,7 +71,7 @@ use std::path::PathBuf;use worktrunk::config::{ProjectConfig, WorktrunkConfig};use worktrunk::git::{GitError, Repository};use worktrunk::shell::Shell;-use worktrunk::styling::{format_error, format_error_with_bold, format_hint};+use worktrunk::styling::{AnstyleStyle, ERROR, HINT, WARNING, eprintln, println};/// Generate hint message for shell integration setup///@@ -106,16 +106,15 @@ impl SwitchResult {path,created_branch,} => {+ let bold = AnstyleStyle::new().bold();let msg = if *created_branch {format!(- "Created new branch and worktree for '{}' at {}",- branch,+ "Created new branch and worktree for {bold}{branch}{bold:#} at {}",path.display())} else {format!(- "Added worktree for existing branch '{}' at {}",- branch,+ "Added worktree for existing branch {bold}{branch}{bold:#} at {}",path.display())};@@ -135,10 +134,11 @@ impl SwitchResult {path,created_branch,} => {+ let bold = AnstyleStyle::new().bold();let msg = if *created_branch {- format!("Created new branch and worktree for '{}'", branch)+ format!("Created new branch and worktree for {bold}{branch}{bold:#}")} else {- format!("Added worktree for existing branch '{}'", branch)+ format!("Added worktree for existing branch {bold}{branch}{bold:#}")};Some(format!("__WORKTRUNK_CD__{}\n{} at {}",@@ -166,7 +166,8 @@ impl RemoveResult {pub fn format_user_output(&self) -> Option<String> {match self {RemoveResult::AlreadyOnDefault(branch) => {- Some(format!("Already on default branch '{}'", branch))+ let bold = AnstyleStyle::new().bold();+ Some(format!("Already on default branch {bold}{branch}{bold:#}"))}RemoveResult::RemovedWorktree { primary_path } => Some(format!("Moved to primary worktree and removed worktree\nPath: {}{}",@@ -174,7 +175,8 @@ impl RemoveResult {shell_integration_hint())),RemoveResult::SwitchedToDefault(branch) => {- Some(format!("Switched to default branch '{}'", branch))+ let bold = AnstyleStyle::new().bold();+ Some(format!("Switched to default branch {bold}{branch}{bold:#}"))}}}@@ -202,19 +204,15 @@ pub fn handle_switch(// Check for conflicting conditionsif create && repo.branch_exists(branch)? {- return Err(GitError::CommandFailed(format_error_with_bold(- "Branch '",- branch,- "' already exists. Remove --create flag to switch to it.",+ let error_bold = ERROR.bold();+ return Err(GitError::CommandFailed(format!(+ "β Branch '{error_bold}{branch}{error_bold:#}' already exists. Remove --create flag to switch to it.")));}// Check if base flag was provided without create flagif base.is_some() && !create {- eprintln!(- "{}",- worktrunk::styling::format_warning("--base flag is only used with --create, ignoring")- );+ eprintln!("π‘ {WARNING}--base flag is only used with --create, ignoring{WARNING:#}");}// Check if worktree already exists for this branch@@ -228,10 +226,9 @@ pub fn handle_switch(return Ok(SwitchResult::ExistingWorktree(canonical_existing_path));}Some(_) => {- return Err(GitError::CommandFailed(format_error_with_bold(- "Worktree directory missing for '",- branch,- "'. Run 'git worktree prune' to clean up.",+ let error_bold = ERROR.bold();+ return Err(GitError::CommandFailed(format!(+ "β Worktree directory missing for '{error_bold}{branch}{error_bold:#}'. Run 'git worktree prune' to clean up.")));}None => {}@@ -341,7 +338,7 @@ pub fn handle_remove() -> Result<RemoveResult, GitError> {// Remove the worktreeif let Err(e) = repo.remove_worktree(&worktree_root) {- eprintln!("Warning: Failed to remove worktree: {}", e);+ eprintln!("π‘ {WARNING}Failed to remove worktree: {e}{WARNING:#}");eprintln!("You may need to run 'git worktree remove {}' manually",worktree_root.display()@@ -405,10 +402,7 @@ fn check_worktree_conflicts(.collect();if !overlapping.is_empty() {- eprintln!(- "{}",- format_error("Cannot push: conflicting uncommitted changes in:")- );+ eprintln!("β {ERROR}Cannot push: conflicting uncommitted changes in:{ERROR:#}");for file in &overlapping {eprintln!(" - {}", file);}@@ -531,10 +525,12 @@ pub fn handle_push(target: Option<&str>, allow_merge_commits: bool) -> Result<()// Check if it's a fast-forwardif !repo.is_ancestor(&target_branch, "HEAD")? {- let error_msg =- format_error_with_bold("Not a fast-forward from '", &target_branch, "' to HEAD");- let hint_msg = format_hint(- "The target branch has commits not in your current branch. Consider 'git pull' or 'git rebase'",+ let error_bold = ERROR.bold();+ let error_msg = format!(+ "β Not a fast-forward from '{error_bold}{target_branch}{error_bold:#}' to HEAD"+ );+ let hint_msg = format!(+ "π‘ {HINT}The target branch has commits not in your current branch. Consider 'git pull' or 'git rebase'{HINT:#}");return Err(GitError::CommandFailed(format!("{}\n{}",@@ -544,8 +540,8 @@ pub fn handle_push(target: Option<&str>, allow_merge_commits: bool) -> Result<()// Check for merge commits unless allowedif !allow_merge_commits && repo.has_merge_commits(&target_branch, "HEAD")? {- return Err(GitError::CommandFailed(format_error(- "Found merge commits in push range. Use --allow-merge-commits to push non-linear history.",+ return Err(GitError::CommandFailed(format!(+ "β {ERROR}Found merge commits in push range. Use --allow-merge-commits to push non-linear history.{ERROR:#}")));}@@ -567,10 +563,8 @@ pub fn handle_push(target: Option<&str>, allow_merge_commits: bool) -> Result<()} else {"commits"};- println!(- "Pushing {} {} to '{}'",- commit_count, commit_text, target_branch- );+ let bold = AnstyleStyle::new().bold();+ println!("Pushing {commit_count} {commit_text} to {bold}{target_branch}{bold:#}");}// Get git common dir for the push@@ -581,6 +575,7 @@ pub fn handle_push(target: Option<&str>, allow_merge_commits: bool) -> Result<()repo.run_command(&["push", git_common_dir.to_str().unwrap(), &push_target]).map_err(|e| GitError::CommandFailed(format!("Push failed: {}", e)))?;- println!("Successfully pushed to '{}'", target_branch);+ let bold = AnstyleStyle::new().bold();+ println!("Successfully pushed to {bold}{target_branch}{bold:#}");Ok(())}diff --git a/src/git.rs b/src/git.rsindex 61064f696..f6aa3e81a 100644--- a/src/git.rs+++ b/src/git.rs@@ -25,8 +25,8 @@ impl std::fmt::Display for GitError {GitError::CommandFailed(msg) => write!(f, "{}", msg),// ParseError messages need formattingGitError::ParseError(msg) => {- use crate::styling::format_error;- write!(f, "{}", format_error(msg))+ use crate::styling::ERROR;+ write!(f, "β {ERROR}{msg}{ERROR:#}")}}}@@ -183,8 +183,9 @@ impl Repository {/// Returns an error if there are uncommitted changes.pub fn ensure_clean_working_tree(&self) -> Result<(), GitError> {if self.is_dirty()? {- return Err(GitError::CommandFailed(crate::styling::format_error(- "Working tree has uncommitted changes. Commit or stash them first.",+ use crate::styling::ERROR;+ return Err(GitError::CommandFailed(format!(+ "β {ERROR}Working tree has uncommitted changes. Commit or stash them first.{ERROR:#}")));}Ok(())diff --git a/src/main.rs b/src/main.rsindex fb072215d..e6931405a 100644--- a/src/main.rs+++ b/src/main.rs@@ -1,8 +1,9 @@+use anstyle::Style;use clap::{CommandFactory, Parser, Subcommand};use std::process;use worktrunk::config::WorktrunkConfig;use worktrunk::git::GitError;-use worktrunk::styling::{dim_style, should_use_color};+use worktrunk::styling::println;mod commands;mod display;@@ -165,15 +166,9 @@ fn main() {result.path.display());// Indent each line of the config content with dim/gray color- if should_use_color() {- let style = dim_style();- for line in result.config_line.lines() {- println!(" {}{}{}", style.render(), line, style.render_reset());- }- } else {- for line in result.config_line.lines() {- println!(" {}", line);- }+ for line in result.config_line.lines() {+ let dim = Style::new().dimmed();+ println!(" {dim}{line}{dim:#}");}}})diff --git a/src/styling.rs b/src/styling.rsindex cecb94d46..28daf0c92 100644--- a/src/styling.rs+++ b/src/styling.rs@@ -1,171 +1,62 @@//! Consolidated styling module for terminal output.//!-//! This module provides:-//! - Color/style detection based on environment variables-//! - Formatted message functions (error, warning, hint, etc.)-//! - Styled string/line types for building complex output+//! This module uses the anstyle ecosystem:+//! - anstream for auto-detecting color support+//! - anstyle for composable styling+//! - Semantic style constants for domain-specific useuse anstyle::{AnsiColor, Color, Style};-use std::io::IsTerminal;use unicode_width::UnicodeWidthStr;// ============================================================================-// Style Definitions (as constant functions to avoid repeated allocation)+// Re-exports from anstream (auto-detecting output)// ============================================================================-/// Get error style (red)-pub fn error_style() -> Style {- Style::new().fg_color(Some(Color::Ansi(AnsiColor::Red)))-}--/// Get warning style (yellow)-pub fn warning_style() -> Style {- Style::new().fg_color(Some(Color::Ansi(AnsiColor::Yellow)))-}--/// Get hint style (dimmed)-pub fn hint_style() -> Style {- Style::new().dimmed()-}--/// Get success style (green)-pub fn success_style() -> Style {- Style::new().fg_color(Some(Color::Ansi(AnsiColor::Green)))-}--/// Get bold style-pub fn bold_style() -> Style {- Style::new().bold()-}+/// Auto-detecting println that respects NO_COLOR, CLICOLOR_FORCE, and terminal capabilities+pub use anstream::println;-/// Get dim style-pub fn dim_style() -> Style {- Style::new().dimmed()-}+/// Auto-detecting eprintln that respects NO_COLOR, CLICOLOR_FORCE, and terminal capabilities+pub use anstream::eprintln;-/// Get error bold style (red + bold)-pub fn error_bold_style() -> Style {- Style::new()- .fg_color(Some(Color::Ansi(AnsiColor::Red)))- .bold()-}+/// Auto-detecting print that respects NO_COLOR, CLICOLOR_FORCE, and terminal capabilities+pub use anstream::print;-/// Get primary style for worktrees (cyan)-pub fn primary_style() -> Style {- Style::new().fg_color(Some(Color::Ansi(AnsiColor::Cyan)))-}--/// Get current style for worktrees (magenta + bold)-pub fn current_style() -> Style {- Style::new()- .bold()- .fg_color(Some(Color::Ansi(AnsiColor::Magenta)))-}--/// Get addition style for diffs (green)-pub fn addition_style() -> Style {- Style::new().fg_color(Some(Color::Ansi(AnsiColor::Green)))-}--/// Get deletion style for diffs (red)-pub fn deletion_style() -> Style {- Style::new().fg_color(Some(Color::Ansi(AnsiColor::Red)))-}--/// Get neutral style for diffs (yellow)-pub fn neutral_style() -> Style {- Style::new().fg_color(Some(Color::Ansi(AnsiColor::Yellow)))-}+/// Auto-detecting eprint that respects NO_COLOR, CLICOLOR_FORCE, and terminal capabilities+pub use anstream::eprint;// ============================================================================-// Color Detection+// Re-exports from anstyle (for composition)// ============================================================================-/// Determines if colored output should be used based on environment-fn should_use_color_with_env(no_color: bool, force_color: bool, is_terminal: bool) -> bool {- if force_color {- return true;- }- if no_color {- return false;- }- is_terminal-}--/// Determines if colored output should be used-pub fn should_use_color() -> bool {- should_use_color_with_env(- std::env::var("NO_COLOR").is_ok(),- std::env::var("CLICOLOR_FORCE").is_ok() || std::env::var("FORCE_COLOR").is_ok(),- std::io::stderr().is_terminal(),- )-}+/// Re-export Style for users who want to compose custom styles+pub use anstyle::Style as AnstyleStyle;// ============================================================================-// Formatted Message Functions+// Semantic Style Constants// ============================================================================-/// Format an error message with red color and β emoji-pub fn format_error(msg: &str) -> String {- if should_use_color() {- let style = error_style();- format!("{}β {}{}", style.render(), msg, style.render_reset())- } else {- format!("β {}", msg)- }-}+/// Error style (red) - use as `{ERROR}text{ERROR:#}`+pub const ERROR: Style = Style::new().fg_color(Some(Color::Ansi(AnsiColor::Red)));-/// Format a warning message with yellow color and π‘ emoji-pub fn format_warning(msg: &str) -> String {- if should_use_color() {- let style = warning_style();- format!("{}π‘ {}{}", style.render(), msg, style.render_reset())- } else {- format!("π‘ {}", msg)- }-}+/// Warning style (yellow) - use as `{WARNING}text{WARNING:#}`+pub const WARNING: Style = Style::new().fg_color(Some(Color::Ansi(AnsiColor::Yellow)));-/// Format a hint message with dim color and π‘ emoji-pub fn format_hint(msg: &str) -> String {- if should_use_color() {- let style = hint_style();- format!("{}π‘ {}{}", style.render(), msg, style.render_reset())- } else {- format!("π‘ {}", msg)- }-}+/// Hint style (dimmed) - use as `{HINT}text{HINT:#}`+pub const HINT: Style = Style::new().dimmed();-/// Format text with bold styling-pub fn bold(text: &str) -> String {- if should_use_color() {- let style = bold_style();- format!("{}{}{}", style.render(), text, style.render_reset())- } else {- text.to_string()- }-}+/// Success style (green) - use as `{SUCCESS}text{SUCCESS:#}`+pub const SUCCESS: Style = Style::new().fg_color(Some(Color::Ansi(AnsiColor::Green)));-/// Format an error message with bold emphasis on specific parts-///-/// Example: `format_error_with_bold("Branch '", "feature-x", "' already exists")`-pub fn format_error_with_bold(prefix: &str, emphasized: &str, suffix: &str) -> String {- if should_use_color() {- let error = error_style();- let error_bold = error_bold_style();- format!(- "{}β {}{}{}{}{}{}",- error.render(),- prefix,- error_bold.render(),- emphasized,- error.render(), // Back to regular red- suffix,- error.render_reset()- )- } else {- format!("β {}{}{}", prefix, emphasized, suffix)- }-}+/// Current worktree style (magenta + bold)+pub const CURRENT: Style = Style::new()+ .bold()+ .fg_color(Some(Color::Ansi(AnsiColor::Magenta)));++/// Addition style for diffs (green)+pub const ADDITION: Style = Style::new().fg_color(Some(Color::Ansi(AnsiColor::Green)));++/// Deletion style for diffs (red)+pub const DELETION: Style = Style::new().fg_color(Some(Color::Ansi(AnsiColor::Red)));// ============================================================================// Styled Output Types@@ -262,25 +153,6 @@ impl StyledLine {mod tests {use super::*;- // Color detection tests- #[test]- fn test_should_use_color_force_color() {- assert!(should_use_color_with_env(false, true, false));- assert!(should_use_color_with_env(true, true, false));- }-- #[test]- fn test_should_use_color_no_color() {- assert!(!should_use_color_with_env(true, false, true));- assert!(!should_use_color_with_env(true, false, false));- }-- #[test]- fn test_should_use_color_terminal() {- assert!(should_use_color_with_env(false, false, true));- assert!(!should_use_color_with_env(false, false, false));- }-// StyledString tests#[test]fn test_styled_string_width() {diff --git a/tests/snapshots/integration__integration_tests__merge__merge_already_on_target.snap b/tests/snapshots/integration__integration_tests__merge__merge_already_on_target.snapindex 89c3d6a54..f35bec46a 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_already_on_target.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_already_on_target.snap@@ -5,6 +5,7 @@ info:args:- mergeenv:+ CLICOLOR_FORCE: "1"GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"GIT_CONFIG_GLOBAL: /dev/null@@ -17,6 +18,6 @@ info:success: trueexit_code: 0----- stdout ------Already on 'main', nothing to merge+Already on [1mmain[0m, nothing to merge----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snap b/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snapindex 114664107..c0cad5f4d 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snap@@ -21,4 +21,4 @@ exit_code: 1----- stdout ---------- stderr ------[31mβ Working tree has uncommitted changes. Commit or stash them first.[0m+β [31mWorking tree has uncommitted changes. Commit or stash them first.[0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_error_detached_head.snap b/tests/snapshots/integration__integration_tests__merge__merge_error_detached_head.snapindex b7983b32c..452848f9a 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_error_detached_head.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_error_detached_head.snap@@ -21,4 +21,4 @@ exit_code: 1----- stdout ---------- stderr ------[31mβ Not on a branch (detached HEAD)[0m+β [31mNot on a branch (detached HEAD)[0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snapindex bd9bd77af..3e83ba151 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap@@ -19,10 +19,10 @@ info:success: trueexit_code: 0----- stdout ------Rebasing onto 'main'...-Fast-forwarding 'main' to current HEAD...-Pushing 1 commit to 'main'-Successfully pushed to 'main'+Rebasing onto [1mmain[0m...+Fast-forwarding [1mmain[0m to current HEAD...+Pushing 1 commit to [1mmain[0m+Successfully pushed to [1mmain[0mCleaning up worktree...Moved to primary worktree and removed worktreePath: [REPO]diff --git a/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snapindex bd9bd77af..3e83ba151 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap@@ -19,10 +19,10 @@ info:success: trueexit_code: 0----- stdout ------Rebasing onto 'main'...-Fast-forwarding 'main' to current HEAD...-Pushing 1 commit to 'main'-Successfully pushed to 'main'+Rebasing onto [1mmain[0m...+Fast-forwarding [1mmain[0m to current HEAD...+Pushing 1 commit to [1mmain[0m+Successfully pushed to [1mmain[0mCleaning up worktree...Moved to primary worktree and removed worktreePath: [REPO]diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snapindex a816cfe99..53a7b60e3 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap@@ -22,10 +22,10 @@ exit_code: 0----- stdout -----Squashing 3 commits into one...Successfully squashed 3 commits into one-Rebasing onto 'main'...-Fast-forwarding 'main' to current HEAD...-Pushing 1 commit to 'main'-Successfully pushed to 'main'+Rebasing onto [1mmain[0m...+Fast-forwarding [1mmain[0m to current HEAD...+Pushing 1 commit to [1mmain[0m+Successfully pushed to [1mmain[0mCleaning up worktree...Moved to primary worktree and removed worktreePath: [REPO]diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snapindex a60d0d3cf..189096255 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap@@ -23,10 +23,10 @@ exit_code: 0----- stdout -----Squashing 2 commits into one...Successfully squashed 2 commits into one-Rebasing onto 'main'...-Fast-forwarding 'main' to current HEAD...-Pushing 1 commit to 'main'-Successfully pushed to 'main'+Rebasing onto [1mmain[0m...+Fast-forwarding [1mmain[0m to current HEAD...+Pushing 1 commit to [1mmain[0m+Successfully pushed to [1mmain[0mCleaning up worktree...Moved to primary worktree and removed worktreePath: [REPO]diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snapindex e0ced77fe..582654fca 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap@@ -20,11 +20,11 @@ info:success: trueexit_code: 0----- stdout ------Only 1 commit since 'main' - no squashing needed-Rebasing onto 'main'...-Fast-forwarding 'main' to current HEAD...-Pushing 1 commit to 'main'-Successfully pushed to 'main'+Only 1 commit since [1mmain[0m - no squashing needed+Rebasing onto [1mmain[0m...+Fast-forwarding [1mmain[0m to current HEAD...+Pushing 1 commit to [1mmain[0m+Successfully pushed to [1mmain[0mCleaning up worktree...Moved to primary worktree and removed worktreePath: [REPO]diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snapindex b705acd31..45b106d3c 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap@@ -24,10 +24,10 @@ exit_code: 0----- stdout -----Squashing 2 commits into one...Successfully squashed 2 commits into one-Rebasing onto 'main'...-Fast-forwarding 'main' to current HEAD...-Pushing 1 commit to 'main'-Successfully pushed to 'main'+Rebasing onto [1mmain[0m...+Fast-forwarding [1mmain[0m to current HEAD...+Pushing 1 commit to [1mmain[0m+Successfully pushed to [1mmain[0mCleaning up worktree...Moved to primary worktree and removed worktreePath: [REPO]diff --git a/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap b/tests/snapshots/integration__integration_tests__merge__merge_to_default.snapindex 47a59568d..84da2e241 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap@@ -18,10 +18,10 @@ info:success: trueexit_code: 0----- stdout ------Rebasing onto 'main'...-Fast-forwarding 'main' to current HEAD...-Pushing 1 commit to 'main'-Successfully pushed to 'main'+Rebasing onto [1mmain[0m...+Fast-forwarding [1mmain[0m to current HEAD...+Pushing 1 commit to [1mmain[0m+Successfully pushed to [1mmain[0mCleaning up worktree...Moved to primary worktree and removed worktreePath: [REPO]diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_keep.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_keep.snapindex aec57f5d1..4b54fc050 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_with_keep.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_with_keep.snap@@ -7,6 +7,7 @@ info:- main- "--keep"env:+ CLICOLOR_FORCE: "1"GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"GIT_CONFIG_GLOBAL: /dev/null@@ -19,10 +20,10 @@ info:success: trueexit_code: 0----- stdout ------Rebasing onto 'main'...-Fast-forwarding 'main' to current HEAD...-Pushing 1 commit to 'main'-Successfully pushed to 'main'-Successfully merged to 'main' (worktree preserved)+Rebasing onto [1mmain[0m...+Fast-forwarding [1mmain[0m to current HEAD...+Pushing 1 commit to [1mmain[0m+Successfully pushed to [1mmain[0m+Successfully merged to [1mmain[0m (worktree preserved)----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_empty_array.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_empty_array.snapindex 744357e6a..7d4ea537f 100644--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_empty_array.snap+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_empty_array.snap@@ -20,7 +20,7 @@ info:success: trueexit_code: 0----- stdout ------Created new branch and worktree for 'feature' at [REPO].feature+Created new branch and worktree for [1mfeature[0m at [REPO].featureTo enable automatic cd, run: wt configure-shelldiff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_failing_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_failing_command.snapindex 872838e59..e0515fcc0 100644--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_failing_command.snap+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_failing_command.snap@@ -20,7 +20,7 @@ info:success: trueexit_code: 0----- stdout ------Created new branch and worktree for 'feature' at [REPO].feature+Created new branch and worktree for [1mfeature[0m at [REPO].featureTo enable automatic cd, run: wt configure-shelldiff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_toml.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_toml.snapindex e0ce83428..8059ee3ae 100644--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_toml.snap+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_toml.snap@@ -20,7 +20,7 @@ info:success: trueexit_code: 0----- stdout ------Created new branch and worktree for 'feature' at [REPO].feature+Created new branch and worktree for [1mfeature[0m at [REPO].featureTo enable automatic cd, run: wt configure-shelldiff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_commands.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_commands.snapindex 99264257f..aec39a194 100644--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_commands.snap+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_commands.snap@@ -22,7 +22,7 @@ exit_code: 0----- stdout -----FirstSecond-Created new branch and worktree for 'feature' at [REPO].feature+Created new branch and worktree for [1mfeature[0m at [REPO].featureTo enable automatic cd, run: wt configure-shelldiff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_no_config.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_no_config.snapindex 744357e6a..7d4ea537f 100644--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_no_config.snap+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_no_config.snap@@ -20,7 +20,7 @@ info:success: trueexit_code: 0----- stdout ------Created new branch and worktree for 'feature' at [REPO].feature+Created new branch and worktree for [1mfeature[0m at [REPO].featureTo enable automatic cd, run: wt configure-shelldiff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_with_approval.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_with_approval.snapindex c6830f68c..e7d6bcf07 100644--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_with_approval.snap+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_with_approval.snap@@ -21,7 +21,7 @@ success: trueexit_code: 0----- stdout -----Setup complete-Created new branch and worktree for 'feature' at [REPO].feature+Created new branch and worktree for [1mfeature[0m at [REPO].featureTo enable automatic cd, run: wt configure-shelldiff --git a/tests/snapshots/integration__integration_tests__push__push_dirty_target.snap b/tests/snapshots/integration__integration_tests__push__push_dirty_target.snapindex 7f7bc34f0..3012fc04e 100644--- a/tests/snapshots/integration__integration_tests__push__push_dirty_target.snap+++ b/tests/snapshots/integration__integration_tests__push__push_dirty_target.snap@@ -21,6 +21,6 @@ exit_code: 1----- stdout ---------- stderr ------[31mβ Cannot push: conflicting uncommitted changes in:[0m+β [31mCannot push: conflicting uncommitted changes in:[0m- conflict.txtCommit or stash changes in [REPO] firstdiff --git a/tests/snapshots/integration__integration_tests__push__push_error_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__push__push_error_not_fast_forward.snapindex 8b8092ef7..27a518a85 100644--- a/tests/snapshots/integration__integration_tests__push__push_error_not_fast_forward.snap+++ b/tests/snapshots/integration__integration_tests__push__push_error_not_fast_forward.snap@@ -21,5 +21,5 @@ exit_code: 1----- stdout ---------- stderr ------[31mβ Not a fast-forward from '[1m[31mmain[31m' to HEAD[0m-[2mπ‘ The target branch has commits not in your current branch. Consider 'git pull' or 'git rebase'[0m+β Not a fast-forward from '[1m[31mmain[0m' to HEAD+π‘ [2mThe target branch has commits not in your current branch. Consider 'git pull' or 'git rebase'[0mdiff --git a/tests/snapshots/integration__integration_tests__push__push_error_with_merge_commits.snap b/tests/snapshots/integration__integration_tests__push__push_error_with_merge_commits.snapindex 4b4e0214c..edf78ca94 100644--- a/tests/snapshots/integration__integration_tests__push__push_error_with_merge_commits.snap+++ b/tests/snapshots/integration__integration_tests__push__push_error_with_merge_commits.snap@@ -21,4 +21,4 @@ exit_code: 1----- stdout ---------- stderr ------[31mβ Found merge commits in push range. Use --allow-merge-commits to push non-linear history.[0m+β [31mFound merge commits in push range. Use --allow-merge-commits to push non-linear history.[0mdiff --git a/tests/snapshots/integration__integration_tests__push__push_fast_forward.snap b/tests/snapshots/integration__integration_tests__push__push_fast_forward.snapindex d6c09cacb..18aaa1f03 100644--- a/tests/snapshots/integration__integration_tests__push__push_fast_forward.snap+++ b/tests/snapshots/integration__integration_tests__push__push_fast_forward.snap@@ -6,6 +6,7 @@ info:- push- mainenv:+ CLICOLOR_FORCE: "1"GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"GIT_CONFIG_GLOBAL: /dev/null@@ -18,7 +19,7 @@ info:success: trueexit_code: 0----- stdout ------Pushing 1 commit to 'main'-Successfully pushed to 'main'+Pushing 1 commit to [1mmain[0m+Successfully pushed to [1mmain[0m----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snapindex d6c09cacb..18aaa1f03 100644--- a/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snap+++ b/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snap@@ -6,6 +6,7 @@ info:- push- mainenv:+ CLICOLOR_FORCE: "1"GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"GIT_CONFIG_GLOBAL: /dev/null@@ -18,7 +19,7 @@ info:success: trueexit_code: 0----- stdout ------Pushing 1 commit to 'main'-Successfully pushed to 'main'+Pushing 1 commit to [1mmain[0m+Successfully pushed to [1mmain[0m----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__push__push_to_default.snap b/tests/snapshots/integration__integration_tests__push__push_to_default.snapindex 6d3d57754..c3bfd30e7 100644--- a/tests/snapshots/integration__integration_tests__push__push_to_default.snap+++ b/tests/snapshots/integration__integration_tests__push__push_to_default.snap@@ -5,6 +5,7 @@ info:args:- pushenv:+ CLICOLOR_FORCE: "1"GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"GIT_CONFIG_GLOBAL: /dev/null@@ -17,7 +18,7 @@ info:success: trueexit_code: 0----- stdout ------Pushing 1 commit to 'main'-Successfully pushed to 'main'+Pushing 1 commit to [1mmain[0m+Successfully pushed to [1mmain[0m----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__remove__remove_already_on_default.snap b/tests/snapshots/integration__integration_tests__remove__remove_already_on_default.snapindex 472c5d5aa..b25ffe3f9 100644--- a/tests/snapshots/integration__integration_tests__remove__remove_already_on_default.snap+++ b/tests/snapshots/integration__integration_tests__remove__remove_already_on_default.snap@@ -1,10 +1,11 @@----source: tests/integration_tests/finish.rs+source: tests/integration_tests/remove.rsinfo:program: wtargs:- - finish+ - removeenv:+ CLICOLOR_FORCE: "1"GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"GIT_CONFIG_GLOBAL: /dev/null@@ -17,6 +18,6 @@ info:success: trueexit_code: 0----- stdout ------Already on default branch 'main'+Already on default branch [1mmain[0m----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__remove__remove_dirty_working_tree.snap b/tests/snapshots/integration__integration_tests__remove__remove_dirty_working_tree.snapindex 25f856d2d..b731f2e36 100644--- a/tests/snapshots/integration__integration_tests__remove__remove_dirty_working_tree.snap+++ b/tests/snapshots/integration__integration_tests__remove__remove_dirty_working_tree.snap@@ -20,4 +20,4 @@ exit_code: 1----- stdout ---------- stderr ------[31mβ Working tree has uncommitted changes. Commit or stash them first.[0m+β [31mWorking tree has uncommitted changes. Commit or stash them first.[0mdiff --git a/tests/snapshots/integration__integration_tests__remove__remove_switch_to_default.snap b/tests/snapshots/integration__integration_tests__remove__remove_switch_to_default.snapindex d50ed18f9..44bc84681 100644--- a/tests/snapshots/integration__integration_tests__remove__remove_switch_to_default.snap+++ b/tests/snapshots/integration__integration_tests__remove__remove_switch_to_default.snap@@ -1,10 +1,11 @@----source: tests/integration_tests/finish.rs+source: tests/integration_tests/remove.rsinfo:program: wtargs:- - finish+ - removeenv:+ CLICOLOR_FORCE: "1"GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"GIT_CONFIG_GLOBAL: /dev/null@@ -17,6 +18,6 @@ info:success: trueexit_code: 0----- stdout ------Switched to default branch 'main'+Switched to default branch [1mmain[0m----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__switch__switch_base_without_create.snap b/tests/snapshots/integration__integration_tests__switch__switch_base_without_create.snapindex 9355bb26a..e30fe2759 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_base_without_create.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_base_without_create.snap@@ -23,4 +23,4 @@ exit_code: 0----- stdout ---------- stderr ------[33mπ‘ --base flag is only used with --create, ignoring[0m+π‘ [33m--base flag is only used with --create, ignoring[0mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_create_existing_error.snap b/tests/snapshots/integration__integration_tests__switch__switch_create_existing_error.snapindex 69c514305..38b9d7db6 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_create_existing_error.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_create_existing_error.snap@@ -22,4 +22,4 @@ exit_code: 1----- stdout ---------- stderr ------[31mβ Branch '[1m[31mfeature-y[31m' already exists. Remove --create flag to switch to it.[0m+β Branch '[1m[31mfeature-y[0m' already exists. Remove --create flag to switch to it.diff --git a/tests/snapshots/integration__integration_tests__switch__switch_create_new.snap b/tests/snapshots/integration__integration_tests__switch__switch_create_new.snapindex 7e3737a9c..a6db01464 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_create_new.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_create_new.snap@@ -20,7 +20,7 @@ info:success: trueexit_code: 0----- stdout ------Created new branch and worktree for 'feature-x' at [REPO].feature-x+Created new branch and worktree for [1mfeature-x[0m at [REPO].feature-xTo enable automatic cd, run: wt configure-shelldiff --git a/tests/snapshots/integration__integration_tests__switch__switch_error_missing_directory.snap b/tests/snapshots/integration__integration_tests__switch__switch_error_missing_directory.snapindex 70ecc784e..436572cc1 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_error_missing_directory.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_error_missing_directory.snap@@ -21,4 +21,4 @@ exit_code: 1----- stdout ---------- stderr ------[31mβ Worktree directory missing for '[1m[31mmissing-wt[31m'. Run 'git worktree prune' to clean up.[0m+β Worktree directory missing for '[1m[31mmissing-wt[0m'. Run 'git worktree prune' to clean up.diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snapindex 3fc7be4a1..2fb894a08 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap@@ -22,7 +22,7 @@ info:success: trueexit_code: 0----- stdout ------Created new branch and worktree for 'file-test' at [REPO].file-test+Created new branch and worktree for [1mfile-test[0m at [REPO].file-testTo enable automatic cd, run: wt configure-shelldiff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snapindex 69e61d25c..7451bd884 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap@@ -23,7 +23,7 @@ success: trueexit_code: 0----- stdout -----test output-Created new branch and worktree for 'exec-test' at [REPO].exec-test+Created new branch and worktree for [1mexec-test[0m at [REPO].exec-testTo enable automatic cd, run: wt configure-shelldiff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snapindex d878b7a95..cb2e5759a 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap@@ -22,6 +22,6 @@ success: trueexit_code: 0----- stdout -----__WORKTRUNK_CD__[REPO].internal-test-Created new branch and worktree for 'internal-test' at [REPO].internal-test+Created new branch and worktree for [1minternal-test[0m at [REPO].internal-test----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__switch__switch_with_base.snap b/tests/snapshots/integration__integration_tests__switch__switch_with_base.snapindex 415a9ae7f..a2523adc6 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_with_base.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_with_base.snap@@ -22,7 +22,7 @@ info:success: trueexit_code: 0----- stdout ------Created new branch and worktree for 'feature-with-base' at [REPO].feature-with-base+Created new branch and worktree for [1mfeature-with-base[0m at [REPO].feature-with-baseTo enable automatic cd, run: wt configure-shell