Skip to content

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

feat: Add `wt config status` commands to manage worktree status

Maximilian Roos60109838e439
diff --git a/.claude-plugin/hooks/hooks.worktree.json b/.claude-plugin/hooks/hooks.worktree.json
deleted file mode 100644
index efbe9437a..000000000
--- a/.claude-plugin/hooks/hooks.worktree.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "hooks": {
- "UserPromptSubmit": [
- {
- "hooks": [
- {
- "type": "command",
- "command": "git rev-parse --is-inside-work-tree >/dev/null 2>&1 && git config extensions.worktreeConfig true 2>/dev/null; git config --worktree worktrunk.status 🤖 2>/dev/null || true"
- }
- ]
- }
- ],
- "Stop": [
- {
- "matcher": "",
- "hooks": [
- {
- "type": "command",
- "command": "git config --worktree --unset worktrunk.status 2>/dev/null || true"
- }
- ]
- }
- ]
- }
-}
diff --git a/.claude-plugin/skills/worktrunk/reference/README.md b/.claude-plugin/skills/worktrunk/reference/README.md
index ae9bd8e5b..06065a117 100644
--- a/.claude-plugin/skills/worktrunk/reference/README.md
+++ b/.claude-plugin/skills/worktrunk/reference/README.md
@@ -364,16 +364,14 @@ args = ["-m", "claude-haiku-4-5-20251001"]
### Custom Worktree Status
-Add emoji status markers to worktrees that appear in `wt list`. Perfect for tracking work-in-progress states, CI status, or team coordination.
-
-**Set status manually:**
+Add emoji status markers to branches that appear in `wt list`. Perfect for tracking work-in-progress states, CI status, or team coordination.
```bash
-# Set an emoji status for a branch (works everywhere)
-git config worktrunk.status.feature-x "🚧"
+# Set status for current branch
+wt config status set "🚧"
-# Clear the status
-git config --unset worktrunk.status.feature-x
+# Or use git config directly
+git config worktrunk.status.feature-x "🚧"
```
**Status appears in the Status column:**
@@ -425,33 +423,6 @@ dirty-with-status ≡?🤖 ./myapp.dirty-with-status/
- Status is shared across all worktrees on the same branch (by design)
- Works with any git repository, no special configuration needed
-<details>
-<summary><b>Alternative: Per-Worktree Status (Advanced)</b></summary>
-
-For true per-worktree isolation (different status for multiple worktrees on the same branch), use worktree-specific config:
-
-**One-time setup (enables per-worktree config for the repo):**
-
-```bash
-git config extensions.worktreeConfig true
-```
-
-**Set status from within a worktree:**
-
-```bash
-# From within the worktree
-git config --worktree worktrunk.status "🚧"
-
-# Clear status
-git config --worktree --unset worktrunk.status
-```
-
-**Claude Code hooks for per-worktree:**
-
-Copy the hooks from [`.claude-plugin/hooks/hooks.worktree.json`](.claude-plugin/hooks/hooks.worktree.json) to your `~/.claude/settings.json`.
-
-**Priority:** Worktree-specific config takes precedence over branch-keyed config when both exist.
-
</details>
</details>
diff --git a/README.md b/README.md
index ae9bd8e5b..06065a117 100644
--- a/README.md
+++ b/README.md
@@ -364,16 +364,14 @@ args = ["-m", "claude-haiku-4-5-20251001"]
### Custom Worktree Status
-Add emoji status markers to worktrees that appear in `wt list`. Perfect for tracking work-in-progress states, CI status, or team coordination.
-
-**Set status manually:**
+Add emoji status markers to branches that appear in `wt list`. Perfect for tracking work-in-progress states, CI status, or team coordination.
```bash
-# Set an emoji status for a branch (works everywhere)
-git config worktrunk.status.feature-x "🚧"
+# Set status for current branch
+wt config status set "🚧"
-# Clear the status
-git config --unset worktrunk.status.feature-x
+# Or use git config directly
+git config worktrunk.status.feature-x "🚧"
```
**Status appears in the Status column:**
@@ -425,33 +423,6 @@ dirty-with-status ≡?🤖 ./myapp.dirty-with-status/
- Status is shared across all worktrees on the same branch (by design)
- Works with any git repository, no special configuration needed
-<details>
-<summary><b>Alternative: Per-Worktree Status (Advanced)</b></summary>
-
-For true per-worktree isolation (different status for multiple worktrees on the same branch), use worktree-specific config:
-
-**One-time setup (enables per-worktree config for the repo):**
-
-```bash
-git config extensions.worktreeConfig true
-```
-
-**Set status from within a worktree:**
-
-```bash
-# From within the worktree
-git config --worktree worktrunk.status "🚧"
-
-# Clear status
-git config --worktree --unset worktrunk.status
-```
-
-**Claude Code hooks for per-worktree:**
-
-Copy the hooks from [`.claude-plugin/hooks/hooks.worktree.json`](.claude-plugin/hooks/hooks.worktree.json) to your `~/.claude/settings.json`.
-
-**Priority:** Worktree-specific config takes precedence over branch-keyed config when both exist.
-
</details>
</details>
diff --git a/src/cli.rs b/src/cli.rs
index 449ac483a..9e34969f4 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -111,6 +111,32 @@ Oil Shell (~/.config/oil/oshrc):
#[arg(long, default_value = DEFAULT_COMMAND_NAME)]
command_name: String,
},
+
+ /// Manage branch status markers
+ Status {
+ #[command(subcommand)]
+ action: StatusAction,
+ },
+}
+
+#[derive(Subcommand)]
+pub enum StatusAction {
+ /// Set status emoji for branch
+ Set {
+ /// Status emoji to display
+ value: String,
+
+ /// Target branch (defaults to current)
+ #[arg(long, add = crate::completion::branch_value_completer())]
+ branch: Option<String>,
+ },
+
+ /// Clear status emoji
+ Unset {
+ /// Branch or "*" for all
+ #[arg(default_value = "", add = crate::completion::branch_value_completer())]
+ target: String,
+ },
}
#[derive(Subcommand)]
diff --git a/src/commands/CLAUDE.md b/src/commands/CLAUDE.md
index dfdcf967c..5afd631c3 100644
--- a/src/commands/CLAUDE.md
+++ b/src/commands/CLAUDE.md
@@ -66,3 +66,19 @@ wt --source -C /path/to/repo beta select
## MCP Limitations
MCP terminals use pseudo-TTY, not real terminals. If tests pass in MCP but users report issues, the bug is likely environment-specific. Always test on the actual problematic repository.
+
+## Shell Completion for CLI Arguments
+
+Branch and worktree arguments should include shell completion for better UX. Add completion helpers to CLI definitions:
+
+```rust
+/// Target branch (defaults to current)
+#[arg(long, add = crate::completion::branch_value_completer())]
+branch: Option<String>,
+```
+
+**Available completers:**
+- `branch_value_completer()` - Completes with branch names
+- `worktree_branch_completer()` - Completes with worktree paths and branch names
+
+**Pattern:** All branch arguments should use `branch_value_completer()` for consistency with commands like `wt merge`, `wt switch --base`, `wt rebase`.
diff --git a/src/commands/config.rs b/src/commands/config.rs
index 9403d0143..512a69673 100644
--- a/src/commands/config.rs
+++ b/src/commands/config.rs
@@ -184,3 +184,79 @@ pub fn handle_config_refresh_cache() -> Result<(), GitError> {
Ok(())
}
+
+/// Handle the config status set command
+pub fn handle_config_status_set(value: String, branch: Option<String>) -> Result<(), GitError> {
+ let repo = Repository::current();
+
+ // TODO: Worktree-specific status (worktrunk.status with --worktree flag) would allow
+ // different statuses per worktree, but requires extensions.worktreeConfig which adds
+ // complexity. Our intended workflow is one branch per worktree, so branch-keyed status
+ // is sufficient for now.
+
+ let branch_name = match branch {
+ Some(b) => b,
+ None => repo.current_branch()?.ok_or_else(|| {
+ GitError::CommandFailed("Not on a branch (detached HEAD)".to_string())
+ })?,
+ };
+
+ let config_key = format!("worktrunk.status.{}", branch_name);
+ repo.run_command(&["config", &config_key, &value])?;
+
+ let branch_bold = GREEN.bold();
+ crate::output::success(format!(
+ "{GREEN}Set status for {branch_bold}{branch_name}{branch_bold:#} to {GREEN_BOLD}{value}{GREEN_BOLD:#}{GREEN:#}"
+ ))?;
+
+ Ok(())
+}
+
+/// Handle the config status unset command
+pub fn handle_config_status_unset(target: String) -> Result<(), GitError> {
+ let repo = Repository::current();
+
+ if target == "*" {
+ // Clear all branch-keyed statuses
+ let output = repo
+ .run_command(&["config", "--get-regexp", "^worktrunk\\.status\\."])
+ .unwrap_or_default();
+
+ let mut cleared_count = 0;
+ for line in output.lines() {
+ if let Some(key) = line.split_whitespace().next() {
+ repo.run_command(&["config", "--unset", key])?;
+ cleared_count += 1;
+ }
+ }
+
+ if cleared_count == 0 {
+ crate::output::info("No statuses to clear")?;
+ } else {
+ crate::output::success(format!(
+ "{GREEN}Cleared {GREEN_BOLD}{cleared_count}{GREEN_BOLD:#} status{}{GREEN:#}",
+ if cleared_count == 1 { "" } else { "es" }
+ ))?;
+ }
+ } else {
+ // Clear specific branch status
+ let branch_name = if target.is_empty() {
+ repo.current_branch()?.ok_or_else(|| {
+ GitError::CommandFailed("Not on a branch (detached HEAD)".to_string())
+ })?
+ } else {
+ target
+ };
+
+ let config_key = format!("worktrunk.status.{}", branch_name);
+ repo.run_command(&["config", "--unset", &config_key])
+ .git_context("Failed to unset status (may not be set)")?;
+
+ let branch_bold = GREEN.bold();
+ crate::output::success(format!(
+ "{GREEN}Cleared status for {branch_bold}{branch_name}{branch_bold:#}{GREEN:#}"
+ ))?;
+ }
+
+ Ok(())
+}
diff --git a/src/commands/mod.rs b/src/commands/mod.rs
index c7ba89895..bfc3c7f68 100644
--- a/src/commands/mod.rs
+++ b/src/commands/mod.rs
@@ -16,7 +16,10 @@ pub mod select;
pub mod standalone;
pub mod worktree;
-pub use config::{handle_config_init, handle_config_list, handle_config_refresh_cache};
+pub use config::{
+ handle_config_init, handle_config_list, handle_config_refresh_cache, handle_config_status_set,
+ handle_config_status_unset,
+};
pub use configure_shell::{ConfigAction, handle_configure_shell};
pub use init::handle_init;
pub use list::handle_list;
diff --git a/src/git/repository/mod.rs b/src/git/repository/mod.rs
index d15438b0f..96189047e 100644
--- a/src/git/repository/mod.rs
+++ b/src/git/repository/mod.rs
@@ -231,16 +231,8 @@ impl Repository {
.filter(|s| !s.is_empty())
}
- /// Read user-defined status, preferring worktree config then falling back to branch-keyed.
+ /// Read user-defined branch-keyed status.
pub fn user_status(&self, branch: Option<&str>) -> Option<String> {
- if let Ok(output) = self.run_command(&["config", "--worktree", "--get", "worktrunk.status"])
- {
- let status = output.trim().to_string();
- if !status.is_empty() {
- return Some(status);
- }
- }
-
branch.and_then(|branch| self.branch_keyed_status(branch))
}
diff --git a/src/main.rs b/src/main.rs
index 93cf22a54..8e80e74f7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -20,13 +20,14 @@ use commands::handle_select;
use commands::worktree::{SwitchResult, handle_push};
use commands::{
ConfigAction, handle_config_init, handle_config_list, handle_config_refresh_cache,
- handle_configure_shell, handle_init, handle_list, handle_merge, handle_rebase, handle_remove,
- handle_squash, handle_standalone_ask_approvals, handle_standalone_clear_approvals,
- handle_standalone_commit, handle_standalone_run_hook, handle_switch,
+ handle_config_status_set, handle_config_status_unset, handle_configure_shell, handle_init,
+ handle_list, handle_merge, handle_rebase, handle_remove, handle_squash,
+ handle_standalone_ask_approvals, handle_standalone_clear_approvals, handle_standalone_commit,
+ handle_standalone_run_hook, handle_switch,
};
use output::{execute_user_command, handle_remove_output, handle_switch_output};
-use cli::{Cli, Commands, ConfigCommand, StandaloneCommand};
+use cli::{Cli, Commands, ConfigCommand, StandaloneCommand, StatusAction};
fn main() {
if completion::maybe_handle_env_completion() {
@@ -176,6 +177,11 @@ fn main() {
})
.git_err()
}
+ ConfigCommand::Status { action } => match action {
+ StatusAction::Set { value, branch } => handle_config_status_set(value, branch),
+ StatusAction::Unset { target } => handle_config_status_unset(target),
+ }
+ .git_err(),
},
Commands::Standalone { action } => match action {
StandaloneCommand::RunHook { hook_type, force } => {
diff --git a/tests/integration_tests/config_status.rs b/tests/integration_tests/config_status.rs
new file mode 100644
index 000000000..6d8a8bdef
--- /dev/null
+++ b/tests/integration_tests/config_status.rs
@@ -0,0 +1,142 @@
+use crate::common::{TestRepo, wt_command};
+use insta::assert_snapshot;
+use std::process::Command;
+
+fn wt_config_status_cmd(repo: &TestRepo, args: &[&str]) -> Command {
+ let mut cmd = wt_command();
+ repo.clean_cli_env(&mut cmd);
+ cmd.args(["config", "status"]);
+ cmd.args(args);
+ cmd.current_dir(repo.root_path());
+ cmd
+}
+
+#[test]
+fn test_config_status_set_branch_default() {
+ let repo = TestRepo::new();
+ repo.commit("Initial commit");
+
+ let output = wt_config_status_cmd(&repo, &["set", "🚧"])
+ .output()
+ .unwrap();
+ assert!(output.status.success());
+ assert_snapshot!(String::from_utf8_lossy(&output.stdout), @"✅ Set status for main to 🚧");
+
+ // Verify it was set
+ let output = repo
+ .git_command(&["config", "--get", "worktrunk.status.main"])
+ .output()
+ .unwrap();
+ assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "🚧");
+}
+
+#[test]
+fn test_config_status_set_branch_specific() {
+ let repo = TestRepo::new();
+ repo.commit("Initial commit");
+ repo.git_command(&["branch", "feature"]).status().unwrap();
+
+ let output = wt_config_status_cmd(&repo, &["set", "--branch", "feature", "🔧"])
+ .output()
+ .unwrap();
+ assert!(output.status.success());
+ assert_snapshot!(String::from_utf8_lossy(&output.stdout), @"✅ Set status for feature to 🔧");
+
+ // Verify it was set
+ let output = repo
+ .git_command(&["config", "--get", "worktrunk.status.feature"])
+ .output()
+ .unwrap();
+ assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "🔧");
+}
+
+#[test]
+fn test_config_status_unset_branch_default() {
+ let repo = TestRepo::new();
+ repo.commit("Initial commit");
+
+ // Set a status first
+ repo.git_command(&["config", "worktrunk.status.main", "🚧"])
+ .status()
+ .unwrap();
+
+ let output = wt_config_status_cmd(&repo, &["unset"]).output().unwrap();
+ assert!(output.status.success());
+ assert_snapshot!(String::from_utf8_lossy(&output.stdout), @"✅ Cleared status for main");
+
+ // Verify it was unset
+ let output = repo
+ .git_command(&["config", "--get", "worktrunk.status.main"])
+ .output()
+ .unwrap();
+ assert!(!output.status.success());
+}
+
+#[test]
+fn test_config_status_unset_branch_specific() {
+ let repo = TestRepo::new();
+ repo.commit("Initial commit");
+
+ // Set a status first
+ repo.git_command(&["config", "worktrunk.status.feature", "🔧"])
+ .status()
+ .unwrap();
+
+ let output = wt_config_status_cmd(&repo, &["unset", "feature"])
+ .output()
+ .unwrap();
+ assert!(output.status.success());
+ assert_snapshot!(String::from_utf8_lossy(&output.stdout), @"✅ Cleared status for feature");
+
+ // Verify it was unset
+ let output = repo
+ .git_command(&["config", "--get", "worktrunk.status.feature"])
+ .output()
+ .unwrap();
+ assert!(!output.status.success());
+}
+
+#[test]
+fn test_config_status_unset_all() {
+ let repo = TestRepo::new();
+ repo.commit("Initial commit");
+
+ // Set multiple statuses
+ repo.git_command(&["config", "worktrunk.status.main", "🚧"])
+ .status()
+ .unwrap();
+ repo.git_command(&["config", "worktrunk.status.feature", "🔧"])
+ .status()
+ .unwrap();
+ repo.git_command(&["config", "worktrunk.status.bugfix", "🐛"])
+ .status()
+ .unwrap();
+
+ let output = wt_config_status_cmd(&repo, &["unset", "*"])
+ .output()
+ .unwrap();
+ assert!(output.status.success());
+ assert_snapshot!(String::from_utf8_lossy(&output.stdout), @"✅ Cleared 3 statuses");
+
+ // Verify all were unset
+ let output = repo
+ .git_command(&["config", "--get-regexp", "^worktrunk\\.status\\."])
+ .output()
+ .unwrap();
+ assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "");
+}
+
+#[test]
+fn test_config_status_unset_all_empty() {
+ let repo = TestRepo::new();
+ repo.commit("Initial commit");
+
+ let output = wt_config_status_cmd(&repo, &["unset", "*"])
+ .output()
+ .unwrap();
+ assert!(output.status.success());
+ assert_snapshot!(String::from_utf8_lossy(&output.stdout), @r###"
+ ⚪ No statuses to clear
+
+ "###);
+}
diff --git a/tests/integration_tests/list.rs b/tests/integration_tests/list.rs
index 8fceeb033..1371e97a8 100644
--- a/tests/integration_tests/list.rs
+++ b/tests/integration_tests/list.rs
@@ -611,27 +611,11 @@ fn test_list_json_with_user_status() {
}
#[test]
-fn test_list_branch_only_ignores_main_worktree_status() {
- // Regression test for bug where branch-only entries incorrectly inherited
- // main worktree's worktree-specific status
+fn test_list_branch_only_with_status() {
+ // Test that branch-only entries (no worktree) can display branch-keyed status
let repo = TestRepo::new();
repo.commit("Initial commit");
- // Set worktree-specific status on main worktree (requires extensions.worktreeConfig)
- let mut cmd = Command::new("git");
- repo.configure_git_cmd(&mut cmd);
- cmd.args(["config", "extensions.worktreeConfig", "true"])
- .current_dir(repo.root_path())
- .output()
- .expect("Failed to enable worktreeConfig");
-
- let mut cmd = Command::new("git");
- repo.configure_git_cmd(&mut cmd);
- cmd.args(["config", "--worktree", "worktrunk.status", "🏠"])
- .current_dir(repo.root_path())
- .output()
- .expect("Failed to set main worktree status");
-
// Create a branch-only entry (no worktree)
let mut cmd = Command::new("git");
repo.configure_git_cmd(&mut cmd);
@@ -649,7 +633,7 @@ fn test_list_branch_only_ignores_main_worktree_status() {
.expect("Failed to set branch status");
// Use --branches flag to show branch-only entries
- snapshot_list_with_branches("branch_only_ignores_main_worktree_status", &repo);
+ snapshot_list_with_branches("branch_only_with_status", &repo);
}
#[test]
diff --git a/tests/integration_tests/mod.rs b/tests/integration_tests/mod.rs
index d64560509..99e4e6d8f 100644
--- a/tests/integration_tests/mod.rs
+++ b/tests/integration_tests/mod.rs
@@ -13,6 +13,7 @@ pub mod completion;
pub mod completion_validation;
pub mod config_init;
pub mod config_list;
+pub mod config_status;
pub mod configure_shell;
pub mod default_branch;
pub mod directives;
diff --git a/tests/snapshots/integration__integration_tests__init__init_bash.snap b/tests/snapshots/integration__integration_tests__init__init_bash.snap
index c231da887..803724770 100644
--- a/tests/snapshots/integration__integration_tests__init__init_bash.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_bash.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmppHjR06/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmplQc7bx/test-config.toml
---
success: true
exit_code: 0
@@ -214,6 +214,15 @@ _wt() {
wt__config,shell)
cmd="wt__config__shell"
;;
+ wt__config,status)
+ cmd="wt__config__status"
+ ;;
+ wt__config__status,set)
+ cmd="wt__config__status__set"
+ ;;
+ wt__config__status,unset)
+ cmd="wt__config__status__unset"
+ ;;
*)
;;
esac
@@ -401,7 +410,7 @@ _wt() {
return 0
;;
wt__config)
- opts="-C -v -h --verbose --help init list refresh-cache shell"
+ opts="-C -v -h --verbose --help init list refresh-cache shell status"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -498,6 +507,64 @@ _wt() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
+ wt__config__status)
+ opts="-C -v -h --verbose --help set unset"
+ if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ fi
+ case "${prev}" in
+ -C)
+ COMPREPLY=($(compgen -f "${cur}"))
+ return 0
+ ;;
+ *)
+ COMPREPLY=()
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ ;;
+ wt__config__status__set)
+ opts="-C -v -h --branch --verbose --help <VALUE>"
+ if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ fi
+ case "${prev}" in
+ --branch)
+ COMPREPLY=($(compgen -f "${cur}"))
+ return 0
+ ;;
+ -C)
+ COMPREPLY=($(compgen -f "${cur}"))
+ return 0
+ ;;
+ *)
+ COMPREPLY=()
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ ;;
+ wt__config__status__unset)
+ opts="-C -v -h --verbose --help [TARGET]"
+ if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ fi
+ case "${prev}" in
+ -C)
+ COMPREPLY=($(compgen -f "${cur}"))
+ return 0
+ ;;
+ *)
+ COMPREPLY=()
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ ;;
wt__init)
opts="-C -v -h --command-name --verbose --help bash fish zsh"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
diff --git a/tests/snapshots/integration__integration_tests__init__init_fish.snap b/tests/snapshots/integration__integration_tests__init__init_fish.snap
index bd01af1e4..0bbe27e9f 100644
--- a/tests/snapshots/integration__integration_tests__init__init_fish.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_fish.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpp7A70A/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpLl28QZ/test-config.toml
---
success: true
exit_code: 0
@@ -198,13 +198,14 @@ complete -c wt -n "__fish_wt_using_subcommand init" -l command-name -d 'Command
complete -c wt -n "__fish_wt_using_subcommand init" -s C -d 'Change working directory' -r -F
complete -c wt -n "__fish_wt_using_subcommand init" -s v -l verbose -d 'Show git commands and debug info'
complete -c wt -n "__fish_wt_using_subcommand init" -s h -l help -d 'Print help'
-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list refresh-cache shell" -s C -d 'Change working directory' -r -F
-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list refresh-cache shell" -s v -l verbose -d 'Show git commands and debug info'
-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list refresh-cache shell" -s h -l help -d 'Print help (see more with \'--help\')'
-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list refresh-cache shell" -f -a "init" -d 'Initialize global configuration file with examples'
-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list refresh-cache shell" -f -a "list" -d 'List all configuration files and their locations'
-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list refresh-cache shell" -f -a "refresh-cache" -d 'Refresh the cached default branch by querying the remote'
-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list refresh-cache shell" -f -a "shell" -d 'Configure shell by writing to config files'
+complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list refresh-cache shell status" -s C -d 'Change working directory' -r -F
+complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list refresh-cache shell status" -s v -l verbose -d 'Show git commands and debug info'
+complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list refresh-cache shell status" -s h -l help -d 'Print help (see more with \'--help\')'
+complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list refresh-cache shell status" -f -a "init" -d 'Initialize global configuration file with examples'
+complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list refresh-cache shell status" -f -a "list" -d 'List all configuration files and their locations'
+complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list refresh-cache shell status" -f -a "refresh-cache" -d 'Refresh the cached default branch by querying the remote'
+complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list refresh-cache shell status" -f -a "shell" -d 'Configure shell by writing to config files'
+complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list refresh-cache shell status" -f -a "status" -d 'Manage branch status markers'
complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from init" -s C -d 'Change working directory' -r -F
complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from init" -s v -l verbose -d 'Show git commands and debug info'
complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from init" -s h -l help -d 'Print help'
@@ -222,6 +223,11 @@ complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand
complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -s f -l force -d 'Skip confirmation prompt'
complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -s v -l verbose -d 'Show git commands and debug info'
complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -s h -l help -d 'Print help (see more with \'--help\')'
+complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from status" -s C -d 'Change working directory' -r -F
+complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from status" -s v -l verbose -d 'Show git commands and debug info'
+complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from status" -s h -l help -d 'Print help'
+complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from status" -f -a "set" -d 'Set status emoji for branch'
+complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from status" -f -a "unset" -d 'Clear status emoji'
complete -c wt -n "__fish_wt_using_subcommand beta; and not __fish_seen_subcommand_from run-hook commit squash push rebase ask-approvals clear-approvals select" -s C -d 'Change working directory' -r -F
complete -c wt -n "__fish_wt_using_subcommand beta; and not __fish_seen_subcommand_from run-hook commit squash push rebase ask-approvals clear-approvals select" -s v -l verbose -d 'Show git commands and debug info'
complete -c wt -n "__fish_wt_using_subcommand beta; and not __fish_seen_subcommand_from run-hook commit squash push rebase ask-approvals clear-approvals select" -s h -l help -d 'Print help'
diff --git a/tests/snapshots/integration__integration_tests__init__init_zsh.snap b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
index d759b19ad..e8ef472fe 100644
--- a/tests/snapshots/integration__integration_tests__init__init_zsh.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmptJsgAq/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpVHSm2d/test-config.toml
---
success: true
exit_code: 0
@@ -241,6 +241,48 @@ _arguments "${_arguments_options[@]}" : \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
+;;
+(status)
+_arguments "${_arguments_options[@]}" : \
+'-C+[Change working directory]:path:_files' \
+'-v[Show git commands and debug info]' \
+'--verbose[Show git commands and debug info]' \
+'-h[Print help]' \
+'--help[Print help]' \
+":: :_wt__config__status_commands" \
+"*::: :->status" \
+&& ret=0
+
+ case $state in
+ (status)
+ words=($line[1] "${words[@]}")
+ (( CURRENT += 1 ))
+ curcontext="${curcontext%:*:*}:wt-config-status-command-$line[1]:"
+ case $line[1] in
+ (set)
+_arguments "${_arguments_options[@]}" : \
+'--branch=[Target branch (defaults to current)]:BRANCH:_default' \
+'-C+[Change working directory]:path:_files' \
+'-v[Show git commands and debug info]' \
+'--verbose[Show git commands and debug info]' \
+'-h[Print help]' \
+'--help[Print help]' \
+':value -- Status emoji to display:_default' \
+&& ret=0
+;;
+(unset)
+_arguments "${_arguments_options[@]}" : \
+'-C+[Change working directory]:path:_files' \
+'-v[Show git commands and debug info]' \
+'--verbose[Show git commands and debug info]' \
+'-h[Print help]' \
+'--help[Print help]' \
+'::target -- Branch or "*" for all:_default' \
+&& ret=0
+;;
+ esac
+ ;;
+esac
;;
esac
;;
@@ -496,6 +538,7 @@ _wt__config_commands() {
'list:List all configuration files and their locations' \
'refresh-cache:Refresh the cached default branch by querying the remote' \
'shell:Configure shell by writing to config files' \
+'status:Manage branch status markers' \
)
_describe -t commands 'wt config commands' commands "$@"
}
@@ -519,6 +562,24 @@ _wt__config__shell_commands() {
local commands; commands=()
_describe -t commands 'wt config shell commands' commands "$@"
}
+(( $+functions[_wt__config__status_commands] )) ||
+_wt__config__status_commands() {
+ local commands; commands=(
+'set:Set status emoji for branch' \
+'unset:Clear status emoji' \
+ )
+ _describe -t commands 'wt config status commands' commands "$@"
+}
+(( $+functions[_wt__config__status__set_commands] )) ||
+_wt__config__status__set_commands() {
+ local commands; commands=()
+ _describe -t commands 'wt config status set commands' commands "$@"
+}
+(( $+functions[_wt__config__status__unset_commands] )) ||
+_wt__config__status__unset_commands() {
+ local commands; commands=()
+ _describe -t commands 'wt config status unset commands' commands "$@"
+}
(( $+functions[_wt__init_commands] )) ||
_wt__init_commands() {
local commands; commands=()
diff --git a/tests/snapshots/integration__integration_tests__list__branch_only_ignores_main_worktree_status.snap b/tests/snapshots/integration__integration_tests__list__branch_only_ignores_main_worktree_status.snap
index 42e01e982..e457652e8 100644
--- a/tests/snapshots/integration__integration_tests__list__branch_only_ignores_main_worktree_status.snap
+++ b/tests/snapshots/integration__integration_tests__list__branch_only_ignores_main_worktree_status.snap
@@ -12,17 +12,18 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpuYiDt0/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpYCSwh8/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
Branch Status HEAD± main↕ Path Remote⇅ Commit Age Message
-main 🏠 . b834638e 10 months ago Initial commit
-branch-only 🌿 b834638e 10 months ago Initial commit
+main . b834638e 10 months ago Initial commit
+branch-only b834638e 10 months ago Initial commit
⚪ Showing 1 worktrees, 1 branches
diff --git a/tests/snapshots/integration__integration_tests__list__branch_only_with_status.snap b/tests/snapshots/integration__integration_tests__list__branch_only_with_status.snap
new file mode 100644
index 000000000..4e275c3ca
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__list__branch_only_with_status.snap
@@ -0,0 +1,30 @@
+---
+source: tests/integration_tests/list.rs
+info:
+ program: wt
+ args:
+ - list
+ - "--branches"
+ 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: /dev/null
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ LANG: C
+ LC_ALL: C
+ SOURCE_DATE_EPOCH: "1761609600"
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpKrAsZ9/test-config.toml
+---
+success: true
+exit_code: 0
+----- stdout -----
+Branch Status HEAD± main↕ Path Remote⇅ Commit Age Message
+main . b834638e 10 months ago Initial commit
+branch-only b834638e 10 months ago Initial commit
+
+⚪ Showing 1 worktrees, 1 branches
+
+----- stderr -----