Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Move `select` and `statusline` out of `beta`
Maximilian Roos41188f5f7e76
diff --git a/README.md b/README.mdindex ce671dc87..f1178bbc5 100644--- a/README.md+++ b/README.md@@ -776,6 +776,10 @@ wt remove # (when already in main worktree)```textwt list — List worktrees and optionally branchesUsage: wt list [OPTIONS]+ wt list <COMMAND>++Commands:+ statusline Single-line status for shell promptsOptions:--format <FORMAT>@@ -1095,7 +1099,7 @@ When using Claude:</details>-### `wt beta select`+### `wt select`Interactive worktree selector with fuzzy search and diff preview. Unix only.@@ -1105,7 +1109,7 @@ Preview tabs (toggle with `1`/`2`/`3`):- **Tab 2**: History (commits not on main highlighted)- **Tab 3**: Branch diff (changes ahead of main)-### `wt beta statusline`+### `wt list statusline`Single-line status for shell prompts, starship, or editor integrations.@@ -1125,7 +1129,7 @@ Add to `~/.claude/settings.json`:{"statusLine": {"type": "command",- "command": "wt beta statusline --claude-code"+ "command": "wt list statusline --claude-code"}}```diff --git a/src/cli.rs b/src/cli.rsindex 8122e4677..c9f88b97f 100644--- a/src/cli.rs+++ b/src/cli.rs@@ -499,15 +499,9 @@ pub enum StepCommand {},}-/// Experimental commands+/// Subcommands for `wt list`#[derive(Subcommand)]-pub enum BetaCommand {- /// Interactive worktree selector- ///- /// Toggle preview tabs with 1/2/3 keys.- #[cfg(unix)]- Select,-+pub enum ListSubcommand {/// Single-line status for shell prompts////// Format: `branch status ±working commits upstream ci`@@ -606,12 +600,11 @@ Docs: <https://llm.datasette.io/> | <https://github.com/sigoden/aichat>action: StepCommand,},- /// Experimental commands- #[command(name = "beta", hide = true)]- Beta {- #[command(subcommand)]- action: BetaCommand,- },+ /// Interactive worktree selector+ ///+ /// Toggle preview tabs with 1/2/3 keys.+ #[cfg(unix)]+ Select,/// List worktrees and optionally branches#[command(after_long_help = "## Columns@@ -705,7 +698,11 @@ jq '.[] | select(.locked != null)'# Get current worktree info (useful for statusline tools)jq '.[] | select(.is_current == true)'```")]+ #[command(args_conflicts_with_subcommands = true)]List {+ #[command(subcommand)]+ subcommand: Option<ListSubcommand>,+/// Output format (table, json)#[arg(long, value_enum, default_value = "table", hide_possible_values = true)]format: OutputFormat,diff --git a/src/commands/CLAUDE.md b/src/commands/CLAUDE.mdindex 3cacf02ac..ca98c40fe 100644--- a/src/commands/CLAUDE.md+++ b/src/commands/CLAUDE.md@@ -1,6 +1,6 @@# Debugging Interactive Terminal Commands-When debugging TUI commands like `wt beta select`, use the `tmux-cli` skill (preferred) or MCP's `node-terminal` tools to test interactively.+When debugging TUI commands like `wt select`, use the `tmux-cli` skill (preferred) or MCP's `node-terminal` tools to test interactively.## Debugging Workflow@@ -25,7 +25,7 @@ tmux-cli send "cd /tmp/wt-select-test/test-repo" --pane=$panetmux-cli wait_idle --pane=$pane# Run with debug logging-tmux-cli send "RUST_LOG=worktrunk=debug cargo run --quiet -- beta select 2> debug.log" --pane=$pane+tmux-cli send "RUST_LOG=worktrunk=debug cargo run --quiet -- select 2> debug.log" --pane=$panetmux-cli wait_idle --pane=$pane# Test interaction (e.g., select option 3)@@ -49,7 +49,7 @@ mcp__node-terminal__terminal_send_key({ sessionId: "test", key: "enter" })// Run with debug loggingmcp__node-terminal__terminal_write({sessionId: "test",- input: "RUST_LOG=worktrunk=debug cargo run --quiet -- beta select 2> debug.log"+ input: "RUST_LOG=worktrunk=debug cargo run --quiet -- select 2> debug.log"})mcp__node-terminal__terminal_send_key({ sessionId: "test", key: "enter" })@@ -71,10 +71,10 @@ tail -100 debug.log | grep -E "error|hang|stuck"```console# Testing with cargo run (already uses local source):-cargo run --quiet -- -C /path/to/repo beta select+cargo run --quiet -- -C /path/to/repo select# Testing with installed wt:-wt --source -C /path/to/repo beta select+wt --source -C /path/to/repo select```## Shell Completion for CLI Argumentsdiff --git a/src/main.rs b/src/main.rsindex 8e827ec7c..eab466bfd 100644--- a/src/main.rs+++ b/src/main.rs@@ -35,8 +35,8 @@ use commands::{use output::{execute_user_command, handle_remove_output, handle_switch_output};use cli::{- ApprovalsCommand, BetaCommand, CacheCommand, Cli, Commands, ConfigCommand, ConfigShellCommand,- StatusAction, StepCommand,+ ApprovalsCommand, CacheCommand, Cli, Commands, ConfigCommand, ConfigShellCommand,+ ListSubcommand, StatusAction, StepCommand,};use worktrunk::HookType;@@ -580,60 +580,63 @@ fn main() {handle_standalone_run_hook(HookType::PostMerge, force)}},- Commands::Beta { action } => match action {- #[cfg(unix)]- BetaCommand::Select => handle_select(cli.internal),- BetaCommand::Statusline { claude_code } => commands::statusline::run(claude_code),- },+ #[cfg(unix)]+ Commands::Select => handle_select(cli.internal),Commands::List {+ subcommand,format,branches,remotes,full,progressive,no_progressive,- } => {- use commands::list::progressive::RenderMode;-- // Load config and merge with CLI flags (CLI flags take precedence)- WorktrunkConfig::load()- .context("Failed to load config")- .and_then(|config| {- // Get config values from global list config- let (show_branches_config, show_remotes_config, show_full_config) = config- .list- .as_ref()- .map(|l| {- (- l.branches.unwrap_or(false),- l.remotes.unwrap_or(false),- l.full.unwrap_or(false),- )- })- .unwrap_or((false, false, false));-- // CLI flags override config- let show_branches = branches || show_branches_config;- let show_remotes = remotes || show_remotes_config;- let show_full = full || show_full_config;-- // Convert two bools to Option<bool>: Some(true), Some(false), or None- let progressive_opt = match (progressive, no_progressive) {- (true, _) => Some(true),- (_, true) => Some(false),- _ => None,- };- let render_mode = RenderMode::detect(progressive_opt, cli.internal);- handle_list(- format,- show_branches,- show_remotes,- show_full,- render_mode,- &config,- )- })- }+ } => match subcommand {+ Some(ListSubcommand::Statusline { claude_code }) => {+ commands::statusline::run(claude_code)+ }+ None => {+ use commands::list::progressive::RenderMode;++ // Load config and merge with CLI flags (CLI flags take precedence)+ WorktrunkConfig::load()+ .context("Failed to load config")+ .and_then(|config| {+ // Get config values from global list config+ let (show_branches_config, show_remotes_config, show_full_config) = config+ .list+ .as_ref()+ .map(|l| {+ (+ l.branches.unwrap_or(false),+ l.remotes.unwrap_or(false),+ l.full.unwrap_or(false),+ )+ })+ .unwrap_or((false, false, false));++ // CLI flags override config+ let show_branches = branches || show_branches_config;+ let show_remotes = remotes || show_remotes_config;+ let show_full = full || show_full_config;++ // Convert two bools to Option<bool>: Some(true), Some(false), or None+ let progressive_opt = match (progressive, no_progressive) {+ (true, _) => Some(true),+ (_, true) => Some(false),+ _ => None,+ };+ let render_mode = RenderMode::detect(progressive_opt, cli.internal);+ handle_list(+ format,+ show_branches,+ show_remotes,+ show_full,+ render_mode,+ &config,+ )+ })+ }+ },Commands::Switch {branch,create,diff --git a/tests/helpers/setup-select-test/Cargo.toml b/tests/helpers/setup-select-test/Cargo.tomlindex a8828998e..4cb1e66d2 100644--- a/tests/helpers/setup-select-test/Cargo.toml+++ b/tests/helpers/setup-select-test/Cargo.toml@@ -1,4 +1,4 @@-# Helper binary to setup test environment for debugging `wt beta select`.+# Helper binary to setup test environment for debugging `wt select`.# This is a workspace member (not a separate workspace) to share target/ and Cargo.lock.# Never published to crates.io (publish = false) - only used during development.[package]diff --git a/tests/helpers/setup-select-test/src/main.rs b/tests/helpers/setup-select-test/src/main.rsindex d4db8845e..2982690e5 100644--- a/tests/helpers/setup-select-test/src/main.rs+++ b/tests/helpers/setup-select-test/src/main.rs@@ -1,4 +1,4 @@-//! Helper binary to setup a test environment for debugging `wt beta select`+//! Helper binary to setup a test environment for debugging `wt select`//!//! This creates a temporary git repository with a known state://! - main branch with 3 commits@@ -7,7 +7,7 @@//! - Some uncommitted changes in the feature worktree//!//! Run with: cargo run --bin setup-select-test-//! Then cd into the printed path and run: wt beta select+//! Then cd into the printed path and run: wt selectuse std::fs;use std::io::{self, Write};@@ -15,7 +15,7 @@ use std::path::PathBuf;use std::process::Command;fn main() {- println!("Setting up test environment for `wt beta select`...\n");+ println!("Setting up test environment for `wt select`...\n");// Create temp directory in /tmplet temp_base = std::env::temp_dir().join("wt-select-test");@@ -135,10 +135,10 @@ fn main() {println!();println!("Method 1 - Using cd:");println!(" cd {}", root.display());- println!(" cargo run --quiet -- beta select");+ println!(" cargo run --quiet -- select");println!();println!("Method 2 - Using -C flag:");- println!(" cargo run --quiet -- -C {} beta select", root.display());+ println!(" cargo run --quiet -- -C {} select", root.display());println!();println!("Expected behavior:");println!(" - Navigate with arrow keys through 8 items");diff --git a/tests/integration_tests/completion.rs b/tests/integration_tests/completion.rsindex 99275de75..e2fd116a8 100644--- a/tests/integration_tests/completion.rs+++ b/tests/integration_tests/completion.rs@@ -283,12 +283,13 @@ fn test_complete_list_command() {let output = repo.completion_cmd(&["wt", "list", ""]).output().unwrap();assert!(output.status.success());let stdout = String::from_utf8_lossy(&output.stdout);+ // wt list suggests flags (--format, --branches, etc.) and subcommands (statusline)assert!(stdout.lines().filter(|line| !line.trim().is_empty())- .all(|line| line.starts_with('-')),- "wt list should only suggest flags, got:\n{stdout}"+ .all(|line| line.starts_with('-') || line == "statusline"),+ "wt list should only suggest flags or 'statusline' subcommand, got:\n{stdout}");});}diff --git a/tests/integration_tests/help.rs b/tests/integration_tests/help.rsindex d838d4d05..698f97827 100644--- a/tests/integration_tests/help.rs+++ b/tests/integration_tests/help.rs@@ -113,11 +113,6 @@ fn help_config_shell() {snapshot_help("help_config_shell", &["config", "shell", "--help"]);}-#[test]-fn help_beta() {- snapshot_help("help_beta", &["beta", "--help"]);-}-#[test]fn help_config_create() {snapshot_help("help_config_create", &["config", "create", "--help"]);diff --git a/tests/integration_tests/select.rs b/tests/integration_tests/select.rsindex e6b6cf326..df47eee05 100644--- a/tests/integration_tests/select.rs+++ b/tests/integration_tests/select.rs@@ -1,4 +1,4 @@-//! TUI snapshot tests for `wt beta select`+//! TUI snapshot tests for `wt select`//!//! These tests use PTY execution combined with vt100 terminal emulation to capture//! what the user actually sees on screen, enabling meaningful snapshot testing of@@ -315,7 +315,7 @@ fn test_select_abort_with_escape() {let env_vars = repo.test_env_vars();let (raw_output, exit_code) = exec_in_pty_with_input(get_cargo_bin("wt").to_str().unwrap(),- &["beta", "select"],+ &["select"],repo.root_path(),&env_vars,"\x1b", // Escape key to abort@@ -339,7 +339,7 @@ fn test_select_with_multiple_worktrees() {let env_vars = repo.test_env_vars();let (raw_output, exit_code) = exec_in_pty_with_input(get_cargo_bin("wt").to_str().unwrap(),- &["beta", "select"],+ &["select"],repo.root_path(),&env_vars,"\x1b", // Escape to abort after viewing@@ -368,7 +368,7 @@ fn test_select_with_branches() {let env_vars = repo.test_env_vars();let (raw_output, exit_code) = exec_in_pty_with_input(get_cargo_bin("wt").to_str().unwrap(),- &["beta", "select"],+ &["select"],repo.root_path(),&env_vars,"\x1b", // Escape to abort@@ -419,7 +419,7 @@ fn test_select_preview_panel_uncommitted() {// Type "feature" to filter to just the feature worktree, press 1 for HEAD± panellet (raw_output, exit_code) = exec_in_pty_with_input_sequence(get_cargo_bin("wt").to_str().unwrap(),- &["beta", "select"],+ &["select"],repo.root_path(),&env_vars,&["feature", "1", "\x1b"], // Type "feature" to filter, 1, Escape@@ -469,7 +469,7 @@ fn test_select_preview_panel_history() {// Type "feature" to filter, press 2 for history panellet (raw_output, exit_code) = exec_in_pty_with_input_sequence(get_cargo_bin("wt").to_str().unwrap(),- &["beta", "select"],+ &["select"],repo.root_path(),&env_vars,&["feature", "2", "\x1b"], // Type "feature", 2, Escape@@ -550,7 +550,7 @@ fn test_new_feature() {// Type "feature" to filter, press 3 for main…± panellet (raw_output, exit_code) = exec_in_pty_with_input_sequence(get_cargo_bin("wt").to_str().unwrap(),- &["beta", "select"],+ &["select"],repo.root_path(),&env_vars,&["feature", "3", "\x1b"], // Type "feature", 3, Escapediff --git a/tests/integration_tests/statusline.rs b/tests/integration_tests/statusline.rsindex a91588059..a2d1f0ab5 100644--- a/tests/integration_tests/statusline.rs+++ b/tests/integration_tests/statusline.rs@@ -1,4 +1,4 @@-//! Snapshot tests for `wt beta statusline` command.+//! Snapshot tests for `wt list statusline` command.//!//! Tests the statusline output for shell prompts and Claude Code integration.@@ -16,7 +16,7 @@ fn run_statusline_from_dir() -> String {let mut cmd = wt_command();cmd.current_dir(cwd);- cmd.args(["beta", "statusline"]);+ cmd.args(["list", "statusline"]);cmd.args(args);// Apply repo's git environment@@ -215,7 +215,7 @@ fn test_statusline_directive_mode() {let mut cmd = wt_command();cmd.current_dir(repo.root_path());- cmd.args(["--internal", "beta", "statusline"]);+ cmd.args(["--internal", "list", "statusline"]);repo.clean_cli_env(&mut cmd);let output = cmd.output().expect("failed to run command");diff --git a/tests/snapshots/integration__integration_tests__help__help_beta.snap b/tests/snapshots/integration__integration_tests__help__help_beta.snapdeleted file mode 100644index 65b40b8d3..000000000--- a/tests/snapshots/integration__integration_tests__help__help_beta.snap+++ /dev/null@@ -1,34 +0,0 @@-----source: tests/integration_tests/help.rs-info:- program: wt- args:- - beta- - "--help"- env:- CLICOLOR_FORCE: "1"- COLUMNS: "150"- GIT_EDITOR: ""- SOURCE_DATE_EPOCH: "1735776000"- WORKTRUNK_BIN: ""- WORKTRUNK_CONFIG_PATH: /nonexistent/test/config.toml-----success: true-exit_code: 0------ stdout ------------ stderr ------wt beta - Experimental commands-Usage: [1m[36mwt beta[0m [36m[OPTIONS][0m [36m<COMMAND>[0m--[1m[32mCommands:[0m- [1m[36mselect[0m Interactive worktree selector- [1m[36mstatusline[0m Single-line status for shell prompts--[1m[32mOptions:[0m- [1m[36m-h[0m, [1m[36m--help[0m Print help--[1m[32mGlobal Options:[0m- [1m[36m-C[0m[36m [0m[36m<path>[0m Working directory for this command- [1m[36m--config[0m[36m [0m[36m<path>[0m User config file path- [1m[36m-v[0m, [1m[36m--verbose[0m Show commands and debug infodiff --git a/tests/snapshots/integration__integration_tests__help__help_list_long.snap b/tests/snapshots/integration__integration_tests__help__help_list_long.snapindex f14e5f7e4..836a68b63 100644--- a/tests/snapshots/integration__integration_tests__help__help_list_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_list_long.snap@@ -20,6 +20,10 @@ exit_code: 0----- stderr -----wt list - List worktrees and optionally branchesUsage: [1m[36mwt list[0m [36m[OPTIONS][0m+ [1m[36mwt list[0m [36m<COMMAND>[0m++[1m[32mCommands:[0m+ [1m[36mstatusline[0m Single-line status for shell prompts[1m[32mOptions:[0m[1m[36m--format[0m[36m [0m[36m<FORMAT>[0mdiff --git a/tests/snapshots/integration__integration_tests__help__help_list_short.snap b/tests/snapshots/integration__integration_tests__help__help_list_short.snapindex 551cd0448..8e0bfde00 100644--- a/tests/snapshots/integration__integration_tests__help__help_list_short.snap+++ b/tests/snapshots/integration__integration_tests__help__help_list_short.snap@@ -20,6 +20,10 @@ exit_code: 0----- stderr -----wt list - List worktrees and optionally branchesUsage: [1m[36mwt list[0m [36m[OPTIONS][0m+ [1m[36mwt list[0m [36m<COMMAND>[0m++[1m[32mCommands:[0m+ [1m[36mstatusline[0m Single-line status for shell prompts[1m[32mOptions:[0m[1m[36m--format[0m[36m [0m[36m<FORMAT>[0m Output format (table, json) [default: table]diff --git a/tests/snapshots/integration__integration_tests__help__help_no_args.snap b/tests/snapshots/integration__integration_tests__help__help_no_args.snapindex 4b3a4743c..1717f054c 100644--- a/tests/snapshots/integration__integration_tests__help__help_no_args.snap+++ b/tests/snapshots/integration__integration_tests__help__help_no_args.snap@@ -22,6 +22,7 @@ Usage: [1m[36mwt[0m [36m[OPTIONS][0m [36m[COMMAND][0m[1m[32mCommands:[0m[1m[36mconfig[0m Manage configuration and shell integration[1m[36mstep[0m Workflow building blocks+ [1m[36mselect[0m Interactive worktree selector[1m[36mlist[0m List worktrees and optionally branches[1m[36mswitch[0m Switch to a worktree[1m[36mremove[0m Remove worktree and branchdiff --git a/tests/snapshots/integration__integration_tests__help__help_root_long.snap b/tests/snapshots/integration__integration_tests__help__help_root_long.snapindex d84cb0d09..9561a6fd2 100644--- a/tests/snapshots/integration__integration_tests__help__help_root_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_root_long.snap@@ -23,6 +23,7 @@ Usage: [1m[36mwt[0m [36m[OPTIONS][0m [36m[COMMAND][0m[1m[32mCommands:[0m[1m[36mconfig[0m Manage configuration and shell integration[1m[36mstep[0m Workflow building blocks+ [1m[36mselect[0m Interactive worktree selector[1m[36mlist[0m List worktrees and optionally branches[1m[36mswitch[0m Switch to a worktree[1m[36mremove[0m Remove worktree and branchdiff --git a/tests/snapshots/integration__integration_tests__help__help_root_short.snap b/tests/snapshots/integration__integration_tests__help__help_root_short.snapindex b80627236..3aaf181c1 100644--- a/tests/snapshots/integration__integration_tests__help__help_root_short.snap+++ b/tests/snapshots/integration__integration_tests__help__help_root_short.snap@@ -23,6 +23,7 @@ Usage: [1m[36mwt[0m [36m[OPTIONS][0m [36m[COMMAND][0m[1m[32mCommands:[0m[1m[36mconfig[0m Manage configuration and shell integration[1m[36mstep[0m Workflow building blocks+ [1m[36mselect[0m Interactive worktree selector[1m[36mlist[0m List worktrees and optionally branches[1m[36mswitch[0m Switch to a worktree[1m[36mremove[0m Remove worktree and branch