Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
feat: Add 'potential conflicts' status symbol
Maximilian Roos5d4789fb4221
diff --git a/src/cli.rs b/src/cli.rsindex f943097aa..a2966e3e4 100644--- a/src/cli.rs+++ b/src/cli.rs@@ -349,9 +349,10 @@ Docs: https://llm.datasette.io/ | https://github.com/sigoden/aichatAge: Time since last commit (relative)Message: Last commit message (truncated)-STATUS SYMBOLS (order: = ≡∅ ↻⋈ ◇⊠⚠ ↑↓ ⇡⇣ ?!+»✘):+STATUS SYMBOLS (order: =≠ ≡∅ ↻⋈ ◇⊠⚠ ↑↓ ⇡⇣ ?!+»✘):· Branch without worktree (no working directory to check)- \x1b[31m=\x1b[0m Merge conflicts (unmerged paths OR --full detected conflicts with main)+ \x1b[31m=\x1b[0m Merge conflicts (unmerged paths in working tree)+ \x1b[33m≠\x1b[0m Potential conflicts with main (--full only, detected via git merge-tree)≡ Working tree matches main (identical contents, regardless of commit history)∅ No commits (no commits ahead AND no uncommitted changes)↻ Rebase in progressdiff --git a/src/commands/list/model.rs b/src/commands/list/model.rsindex ee813b0f1..a9cf44299 100644--- a/src/commands/list/model.rs+++ b/src/commands/list/model.rs@@ -609,10 +609,14 @@ impl PositionMask {/// - All working tree symbols (?!+»✘): Can have multiple types of changes#[derive(Debug, Clone, Default, serde::Serialize)]pub struct StatusSymbols {- /// Merge conflicts indicator+ /// Actual merge conflicts in working tree (unmerged paths)/// Position 0a - Boolean flag (= or empty)pub(crate) has_conflicts: bool,+ /// Potential conflicts with main branch (detected via --full)+ /// Position 0a2 - Boolean flag (≠ or empty)+ pub(crate) has_potential_conflicts: bool,+/// Branch state relative to main/// Position 0b - MUTUALLY EXCLUSIVE (enforced by enum)pub(crate) branch_state: BranchState,@@ -678,12 +682,15 @@ impl StatusSymbols {// Build list of (position_index, content, has_data) tuples// Ordered by importance/actionability// Apply colors based on semantic meaning:- // - Red (ERROR): Conflicts (blocking problems)- // - Yellow (WARNING): Git operations, locked/prunable (active/stuck states)+ // - Red (ERROR): Actual conflicts (blocking problems requiring immediate action)+ // - Yellow (WARNING): Potential conflicts, git operations, locked/prunable (warnings)// - Cyan: Working tree changes (activity)// - Dimmed (HINT): Branch state symbols that indicate removability+ // Conflicts: actual (=) and potential (≠) are mutually exclusivelet conflicts_str = if self.has_conflicts {format!("{ERROR}={ERROR:#}")+ } else if self.has_potential_conflicts {+ format!("{WARNING}≠{WARNING:#}")} else {String::new()};@@ -723,8 +730,12 @@ impl StatusSymbols {(PositionMask::POS_0A_CONFLICTS,conflicts_str.as_str(),- if self.has_conflicts { 1 } else { 0 },- self.has_conflicts,+ if self.has_conflicts || self.has_potential_conflicts {+ 1+ } else {+ 0+ },+ self.has_conflicts || self.has_potential_conflicts,),(PositionMask::POS_0C_GIT_OPERATION,@@ -802,7 +813,12 @@ impl StatusSymbols {let mut widths = [0; 8];widths[PositionMask::POS_3_WORKING_TREE] = self.working_tree.width();- widths[PositionMask::POS_0A_CONFLICTS] = if self.has_conflicts { 1 } else { 0 };+ widths[PositionMask::POS_0A_CONFLICTS] =+ if self.has_conflicts || self.has_potential_conflicts {+ 1+ } else {+ 0+ };widths[PositionMask::POS_0C_GIT_OPERATION] = self.git_operation.to_string().width();widths[PositionMask::POS_1_MAIN_DIVERGENCE] = self.main_divergence.to_string().width();widths[PositionMask::POS_2_UPSTREAM_DIVERGENCE] =@@ -818,6 +834,7 @@ impl StatusSymbols {/// Check if symbols are emptypub fn is_empty(&self) -> bool {!self.has_conflicts+ && !self.has_potential_conflicts&& self.branch_state == BranchState::None&& self.git_operation == GitOperation::None&& self.worktree_attrs.is_empty()@@ -1007,14 +1024,14 @@ impl WorktreeInfo {};// Build complete status symbols with type-safe enums- // Order: = ≡∅ ↻⋈ ◇⊠⚠ | ↑↓ | ⇡⇣ | ?!+»✘+ // Order: =≠ ≡∅ ↻⋈ ◇⊠⚠ | ↑↓ | ⇡⇣ | ?!+»✘// ^0a 0b 0c 0d^ ^1^ ^2^ ^3+^let mut symbols = status_info.symbols;- // Add merge conflicts indicator if this branch has conflicts with base- // (different from git status conflicts which are already in has_conflicts)+ // Add potential conflicts indicator if this branch has conflicts with base (--full only)+ // This is separate from actual unmerged files which are already in has_conflictsif has_conflicts {- symbols.has_conflicts = true;+ symbols.has_potential_conflicts = true;}// Branch state: ≡ matches main, ∅ no commits (mutually exclusive)diff --git a/tests/snapshots/integration__integration_tests__list__json_with_display_fields.snap b/tests/snapshots/integration__integration_tests__list__json_with_display_fields.snapindex fdf736ba9..96ca6b18b 100644--- a/tests/snapshots/integration__integration_tests__list__json_with_display_fields.snap+++ b/tests/snapshots/integration__integration_tests__list__json_with_display_fields.snap@@ -16,7 +16,7 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpDIjjzc/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpvFchbF/test-config.toml---success: trueexit_code: 0@@ -56,6 +56,7 @@ exit_code: 0"pr_status": null,"status_symbols": {"has_conflicts": false,+ "has_potential_conflicts": false,"branch_state": "","git_operation": "","worktree_attrs": "",@@ -95,6 +96,7 @@ exit_code: 0"pr_status": null,"status_symbols": {"has_conflicts": false,+ "has_potential_conflicts": false,"branch_state": "","git_operation": "","worktree_attrs": "",@@ -138,6 +140,7 @@ exit_code: 0"pr_status": null,"status_symbols": {"has_conflicts": false,+ "has_potential_conflicts": false,"branch_state": "∅","git_operation": "","worktree_attrs": "",diff --git a/tests/snapshots/integration__integration_tests__list__json_with_metadata.snap b/tests/snapshots/integration__integration_tests__list__json_with_metadata.snapindex 93185c133..5d14ddcf0 100644--- a/tests/snapshots/integration__integration_tests__list__json_with_metadata.snap+++ b/tests/snapshots/integration__integration_tests__list__json_with_metadata.snap@@ -16,7 +16,7 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpNSZOFm/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp9iVH2N/test-config.toml---success: trueexit_code: 0@@ -56,6 +56,7 @@ exit_code: 0"pr_status": null,"status_symbols": {"has_conflicts": false,+ "has_potential_conflicts": false,"branch_state": "","git_operation": "","worktree_attrs": "",@@ -99,6 +100,7 @@ exit_code: 0"pr_status": null,"status_symbols": {"has_conflicts": false,+ "has_potential_conflicts": false,"branch_state": "≡","git_operation": "","worktree_attrs": "",@@ -143,6 +145,7 @@ exit_code: 0"pr_status": null,"status_symbols": {"has_conflicts": false,+ "has_potential_conflicts": false,"branch_state": "≡","git_operation": "","worktree_attrs": "⊠",diff --git a/tests/snapshots/integration__integration_tests__list__json_with_user_status.snap b/tests/snapshots/integration__integration_tests__list__json_with_user_status.snapindex 7526a3c2a..ba3584b84 100644--- a/tests/snapshots/integration__integration_tests__list__json_with_user_status.snap+++ b/tests/snapshots/integration__integration_tests__list__json_with_user_status.snap@@ -16,7 +16,7 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpcTmZuL/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp7D6YbP/test-config.toml---success: trueexit_code: 0@@ -56,6 +56,7 @@ exit_code: 0"pr_status": null,"status_symbols": {"has_conflicts": false,+ "has_potential_conflicts": false,"branch_state": "","git_operation": "","worktree_attrs": "",@@ -99,6 +100,7 @@ exit_code: 0"pr_status": null,"status_symbols": {"has_conflicts": false,+ "has_potential_conflicts": false,"branch_state": "≡","git_operation": "","worktree_attrs": "",@@ -143,6 +145,7 @@ exit_code: 0"pr_status": null,"status_symbols": {"has_conflicts": false,+ "has_potential_conflicts": false,"branch_state": "≡","git_operation": "","worktree_attrs": "",