Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
feat(config): Introduce `wt config var` command
Maximilian Roos2da8c3304cb9
diff --git a/.claude-plugin/hooks/hooks.json b/.claude-plugin/hooks/hooks.jsonindex dde4059bd..596bdddc8 100644--- a/.claude-plugin/hooks/hooks.json+++ b/.claude-plugin/hooks/hooks.json@@ -5,7 +5,7 @@"hooks": [{"type": "command",- "command": "git branch --show-current 2>/dev/null | xargs -I {} git config worktrunk.status.{} π€"+ "command": "git branch --show-current 2>/dev/null | xargs -I {} git config worktrunk.marker.{} π€"}]}@@ -16,7 +16,7 @@"hooks": [{"type": "command",- "command": "git branch --show-current 2>/dev/null | xargs -I {} git config worktrunk.status.{} π¬"+ "command": "git branch --show-current 2>/dev/null | xargs -I {} git config worktrunk.marker.{} π¬"}]}@@ -27,7 +27,7 @@"hooks": [{"type": "command",- "command": "git branch --show-current 2>/dev/null | xargs -I {} git config --unset worktrunk.status.{} 2>/dev/null || true"+ "command": "git branch --show-current 2>/dev/null | xargs -I {} git config --unset worktrunk.marker.{} 2>/dev/null || true"}]}diff --git a/README.md b/README.mdindex 3efffd10b..bbb7830ce 100644--- a/README.md+++ b/README.md@@ -336,7 +336,7 @@ test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finThe Worktrunk plugin adds Claude Code session tracking to `wt list`:-<!-- β οΈ AUTO-GENERATED from tests/snapshots/integration__integration_tests__list__with_user_status.snap β edit source to update -->+<!-- β οΈ AUTO-GENERATED from tests/snapshots/integration__integration_tests__list__with_user_marker.snap β edit source to update -->```console$ wt list@@ -367,9 +367,9 @@ claude plugin install worktrunk@worktrunkSet status markers manually for any workflow:```console-wt config status set "π§" # Current branch-wt config status set "β " --branch feature # Specific branch-git config worktrunk.status.feature "π¬" # Direct git config+wt config var set marker "π§" # Current branch+wt config var set marker "β " --branch feature # Specific branch+git config worktrunk.marker.feature "π¬" # Direct git config```</details>@@ -978,7 +978,7 @@ with the same fields in the same order as Status Symbols above:- `git_operation`: `""` | `"Rebase"` | `"Merge"`- `main_divergence`: `""` | `"Ahead"` | `"Behind"` | `"Diverged"`- `upstream_divergence`: `""` | `"Ahead"` | `"Behind"` | `"Diverged"`-- `user_status`: string (optional)+- `user_marker`: string (optional)**`status_symbols`** - Unicode symbols for display (same fields, plus `worktree_attrs`: β/β«/β )@@ -1030,7 +1030,7 @@ Commands:create Create user configuration fileshow Show configuration files & locationscache Manage caches (CI status, default branch)- status Manage branch status markers+ var Get or set runtime variables (stored in git config)approvals Manage command approvalsOptions:diff --git a/docs/content/advanced.md b/docs/content/advanced.mdindex 497a9d253..36c6f3ef8 100644--- a/docs/content/advanced.md+++ b/docs/content/advanced.md@@ -37,9 +37,9 @@ $ claude plugin install worktrunk@worktrunkSet status markers manually for any workflow:```bash-$ wt config status set "π§" # Current branch-$ wt config status set "β " --branch feature # Specific branch-$ git config worktrunk.status.feature "π¬" # Direct git config+$ wt config var set marker "π§" # Current branch+$ wt config var set marker "β " --branch feature # Specific branch+$ git config worktrunk.marker.feature "π¬" # Direct git config```## Statusline Integrationdiff --git a/docs/content/commands.md b/docs/content/commands.mdindex f2414e2ae..07003c5a2 100644--- a/docs/content/commands.md+++ b/docs/content/commands.md@@ -520,7 +520,7 @@ with the same fields in the same order as Status Symbols above:- `git_operation`: `""` | `"Rebase"` | `"Merge"`- `main_divergence`: `""` | `"Ahead"` | `"Behind"` | `"Diverged"`- `upstream_divergence`: `""` | `"Ahead"` | `"Behind"` | `"Diverged"`-- `user_status`: string (optional)+- `user_marker`: string (optional)**`status_symbols`** - Unicode symbols for display (same fields, plus `worktree_attrs`: β/β«/β )@@ -571,7 +571,7 @@ Commands:create Create user configuration fileshow Show configuration files & locationscache Manage caches (CI status, default branch)- status Manage branch status markers+ var Get or set runtime variables (stored in git config)approvals Manage command approvalsOptions:diff --git a/docs/content/tips-patterns.md b/docs/content/tips-patterns.mdindex 256163a3d..3e910576d 100644--- a/docs/content/tips-patterns.md+++ b/docs/content/tips-patterns.md@@ -53,9 +53,9 @@ Custom emoji markers show agent state in `wt list`. The Claude Code plugin setsSet status manually for any workflow:```bash-wt config status set "π§" # Current branch-wt config status set "β " --branch feature # Specific branch-git config worktrunk.status.feature "π¬" # Direct git config+wt config var set marker "π§" # Current branch+wt config var set marker "β " --branch feature # Specific branch+git config worktrunk.marker.feature "π¬" # Direct git config```See [Claude Code Integration](/advanced/#claude-code-integration) for plugin installation.diff --git a/src/cli.rs b/src/cli.rsindex 408d29831..c364b3da4 100644--- a/src/cli.rs+++ b/src/cli.rs@@ -294,10 +294,36 @@ If a config file doesn't exist, shows defaults that would be used."#action: CacheCommand,},- /// Manage branch status markers- Status {+ /// Get or set runtime variables (stored in git config)+ #[command(+ after_long_help = r#"Variables are runtime values stored in git config, separate from+configuration files. Use `wt config show` to view file-based configuration.++## Available Variables++- **default-branch**: The repository's default branch (read-only, cached)+- **marker**: Custom status marker for a branch (shown in `wt list`)++## Examples++Get the default branch:+```console+wt config var get default-branch+```++Set a marker for current branch:+```console+wt config var set marker "π§ WIP"+```++Clear markers:+```console+wt config var clear marker --all+```"#+ )]+ Var {#[command(subcommand)]- action: StatusAction,+ action: VarCommand,},/// Manage command approvals@@ -342,35 +368,6 @@ wt config approvals clear --global},}-#[derive(Subcommand)]-pub enum StatusAction {- /// Set status emoji for branch- #[command(- after_long_help = r#"Sets a custom status marker that appears in `wt list` output.--Use emojis or short text to indicate work state (e.g., π§ WIP, β ready, π blocked).-Stored in git config under `worktrunk.status.<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- #[command(- after_long_help = r#"Removes status marker from branch(es). Use '*' to clear all statuses."#- )]- Unset {- /// Branch or '*' for all- #[arg(default_value = "", add = crate::completion::branch_value_completer())]- target: String,- },-}-#[derive(Subcommand)]pub enum CacheCommand {/// Show cached data@@ -399,6 +396,125 @@ Use when the remote default branch has changed. The cached value is used byRefresh,}+#[derive(Subcommand)]+pub enum VarCommand {+ /// Get a variable value+ #[command(after_long_help = r#"Variables:++- **default-branch**: The repository's default branch (main, master, etc.)+- **marker**: Custom status marker for a branch (shown in `wt list`)+- **ci-status**: CI/PR status for a branch (passed, running, failed, conflicts, noci)++## Examples++Get the default branch:+```console+wt config var get default-branch+```++Force refresh from remote:+```console+wt config var get default-branch --refresh+```++Get marker for current branch:+```console+wt config var get marker+```++Get marker for a specific branch:+```console+wt config var get marker --branch=feature+```++Get CI status for current branch:+```console+wt config var get ci-status+```++Force refresh CI status (bypass cache):+```console+wt config var get ci-status --refresh+```"#)]+ Get {+ /// Variable: 'default-branch', 'marker', or 'ci-status'+ #[arg(value_parser = ["default-branch", "marker", "ci-status"])]+ key: String,++ /// Force refresh (for cached variables)+ #[arg(long)]+ refresh: bool,++ /// Target branch (for branch-scoped variables)+ #[arg(long, add = crate::completion::branch_value_completer())]+ branch: Option<String>,+ },++ /// Set a variable value+ #[command(after_long_help = r#"Variables:++- **marker**: Custom status marker displayed in `wt list` output++## Examples++Set marker for current branch:+```console+wt config var set marker "π§ WIP"+```++Set marker for a specific branch:+```console+wt config var set marker "β ready" --branch=feature+```"#)]+ Set {+ /// Variable: 'marker'+ #[arg(value_parser = ["marker"])]+ key: String,++ /// Value to set+ value: String,++ /// Target branch (defaults to current)+ #[arg(long, add = crate::completion::branch_value_completer())]+ branch: Option<String>,+ },++ /// Clear a variable value+ #[command(after_long_help = r#"Variables:++- **marker**: Custom status marker for a branch++## Examples++Clear marker for current branch:+```console+wt config var clear marker+```++Clear marker for a specific branch:+```console+wt config var clear marker --branch=feature+```++Clear all markers:+```console+wt config var clear marker --all+```"#)]+ Clear {+ /// Variable: 'marker'+ #[arg(value_parser = ["marker"])]+ key: String,++ /// Target branch (defaults to current)+ #[arg(long, add = crate::completion::branch_value_completer(), conflicts_with = "all")]+ branch: Option<String>,++ /// Clear all values+ #[arg(long)]+ all: bool,+ },+}+/// Workflow building blocks#[derive(Subcommand)]pub enum StepCommand {@@ -665,7 +781,7 @@ with the same fields in the same order as Status Symbols above:- `git_operation`: `\"\"` | `\"Rebase\"` | `\"Merge\"`- `main_divergence`: `\"\"` | `\"Ahead\"` | `\"Behind\"` | `\"Diverged\"`- `upstream_divergence`: `\"\"` | `\"Ahead\"` | `\"Behind\"` | `\"Diverged\"`-- `user_status`: string (optional)+- `user_marker`: string (optional)**`status_symbols`** - Unicode symbols for display (same fields, plus `worktree_attrs`: β/β«/β )diff --git a/src/commands/config.rs b/src/commands/config.rsindex a9637d83f..fb0260458 100644--- a/src/commands/config.rs+++ b/src/commands/config.rs@@ -402,69 +402,160 @@ fn require_user_config_path() -> anyhow::Result<PathBuf> {})}-/// Handle the config status set command-pub fn handle_config_status_set(value: String, branch: Option<String>) -> anyhow::Result<()> {- let repo = Repository::current();+/// Handle the var get command+pub fn handle_var_get(key: &str, refresh: bool, branch: Option<String>) -> anyhow::Result<()> {+ use super::list::ci_status::PrStatus;- // 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 repo = Repository::current();- let branch_name = match branch {- Some(b) => b,- None => repo.require_current_branch("set status for current branch")?,- };+ match key {+ "default-branch" => {+ let branch_name = if refresh {+ crate::output::progress("Querying remote for default branch...")?;+ repo.refresh_default_branch()?+ } else {+ repo.default_branch()?+ };+ crate::output::data(branch_name)?;+ }+ "marker" => {+ let branch_name = match branch {+ Some(b) => b,+ None => repo.require_current_branch("get marker for current branch")?,+ };+ match repo.branch_keyed_marker(&branch_name) {+ Some(marker) => crate::output::data(marker)?,+ None => crate::output::data("")?,+ }+ }+ "ci-status" => {+ let branch_name = match branch {+ Some(b) => b,+ None => repo.require_current_branch("get ci-status for current branch")?,+ };++ let repo_root = repo.worktree_root()?;++ // Get the HEAD commit for this branch+ let head = repo+ .run_command(&["rev-parse", &branch_name])+ .map(|s| s.trim().to_string())+ .unwrap_or_default();++ if head.is_empty() {+ anyhow::bail!("Branch '{branch_name}' not found");+ }- let config_key = format!("worktrunk.status.{}", branch_name);- repo.run_command(&["config", &config_key, &value])?;+ if refresh {+ crate::output::progress("Fetching CI status...")?;+ // Clear cache to force refresh+ let config_key = format!(+ "worktrunk.ci.{}",+ super::list::ci_status::CachedCiStatus::escape_branch(&branch_name)+ );+ let _ = repo.run_command(&["config", "--unset", &config_key]);+ }- crate::output::success(cformat!(- "Set status for <bold>{branch_name}</> to <bold>{value}</>"- ))?;+ match PrStatus::detect(&branch_name, &head, &repo_root) {+ Some(status) => {+ // Output the CI status as a simple string for piping+ let status_str = match status.ci_status {+ super::list::ci_status::CiStatus::Passed => "passed",+ super::list::ci_status::CiStatus::Running => "running",+ super::list::ci_status::CiStatus::Failed => "failed",+ super::list::ci_status::CiStatus::Conflicts => "conflicts",+ super::list::ci_status::CiStatus::NoCI => "noci",+ super::list::ci_status::CiStatus::Error => "error",+ };+ crate::output::data(status_str)?;+ }+ None => {+ crate::output::data("noci")?;+ }+ }+ }+ _ => anyhow::bail!(+ "Unknown variable: {key}. Valid variables: default-branch, marker, ci-status"+ ),+ }Ok(())}-/// Handle the config status unset command-pub fn handle_config_status_unset(target: String) -> anyhow::Result<()> {+/// Handle the var set command+pub fn handle_var_set(key: &str, value: String, branch: Option<String>) -> anyhow::Result<()> {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;- }- }+ match key {+ "marker" => {+ // TODO: Worktree-specific marker (worktrunk.marker with --worktree flag) would allow+ // different markers per worktree, but requires extensions.worktreeConfig which adds+ // complexity. Our intended workflow is one branch per worktree, so branch-keyed marker+ // is sufficient for now.++ let branch_name = match branch {+ Some(b) => b,+ None => repo.require_current_branch("set marker for current branch")?,+ };++ let config_key = format!("worktrunk.marker.{}", branch_name);+ repo.run_command(&["config", &config_key, &value])?;- if cleared_count == 0 {- crate::output::info("No statuses to clear")?;- } else {crate::output::success(cformat!(- "Cleared <bold>{cleared_count}</> status{}",- if cleared_count == 1 { "" } else { "es" }+ "Set marker for <bold>{branch_name}</> to <bold>{value}</>"))?;}- } else {- // Clear specific branch status- let branch_name = if target.is_empty() {- repo.require_current_branch("clear status for current branch")?- } else {- target- };+ _ => anyhow::bail!("Unknown variable: {key}. Valid variables: marker"),+ }++ Ok(())+}++/// Handle the var clear command+pub fn handle_var_clear(key: &str, branch: Option<String>, all: bool) -> anyhow::Result<()> {+ let repo = Repository::current();- let config_key = format!("worktrunk.status.{}", branch_name);- repo.run_command(&["config", "--unset", &config_key])- .context("Failed to unset status (may not be set)")?;+ match key {+ "marker" => {+ if all {+ // Clear all branch-keyed markers+ // Note: git config --get-regexp exits with code 1 when no matches found,+ // so we treat errors the same as empty output (both mean "no markers")+ let output = repo+ .run_command(&["config", "--get-regexp", "^worktrunk\\.marker\\."])+ .unwrap_or_default();++ let mut cleared_count = 0;+ for line in output.lines() {+ if let Some(config_key) = line.split_whitespace().next() {+ repo.run_command(&["config", "--unset", config_key])?;+ cleared_count += 1;+ }+ }- crate::output::success(cformat!("Cleared status for <bold>{branch_name}</>"))?;+ if cleared_count == 0 {+ crate::output::info("No markers to clear")?;+ } else {+ crate::output::success(cformat!(+ "Cleared <bold>{cleared_count}</> marker{}",+ if cleared_count == 1 { "" } else { "s" }+ ))?;+ }+ } else {+ // Clear specific branch marker+ let branch_name = match branch {+ Some(b) => b,+ None => repo.require_current_branch("clear marker for current branch")?,+ };++ let config_key = format!("worktrunk.marker.{}", branch_name);+ repo.run_command(&["config", "--unset", &config_key])+ .context("Failed to clear marker (may not be set)")?;++ crate::output::success(cformat!("Cleared marker for <bold>{branch_name}</>"))?;+ }+ }+ _ => anyhow::bail!("Unknown variable: {key}. Valid variables: marker"),}Ok(())diff --git a/src/commands/list/collect.rs b/src/commands/list/collect.rsindex 658100812..2b3bd9811 100644--- a/src/commands/list/collect.rs+++ b/src/commands/list/collect.rs@@ -33,7 +33,7 @@ use super::model::{/// Context for status symbol computation during result processingstruct StatusContext {has_merge_tree_conflicts: bool,- user_status: Option<String>,+ user_marker: Option<String>,working_tree_symbols: Option<String>,has_conflicts: bool,}@@ -99,9 +99,9 @@ pub(super) enum TaskResult {git_operation: GitOperationState,},/// User-defined status from git config- UserStatus {+ UserMarker {item_idx: usize,- user_status: Option<String>,+ user_marker: Option<String>,},/// Upstream tracking statusUpstream {@@ -126,7 +126,7 @@ impl TaskResult {| TaskResult::WorkingTreeDiff { item_idx, .. }| TaskResult::MergeTreeConflicts { item_idx, .. }| TaskResult::GitOperation { item_idx, .. }- | TaskResult::UserStatus { item_idx, .. }+ | TaskResult::UserMarker { item_idx, .. }| TaskResult::Upstream { item_idx, .. }| TaskResult::CiStatus { item_idx, .. } => *item_idx,}@@ -228,7 +228,7 @@ fn drain_results(let mut status_contexts: Vec<StatusContext> = (0..items.len()).map(|_| StatusContext {has_merge_tree_conflicts: false,- user_status: None,+ user_marker: None,working_tree_symbols: None,has_conflicts: false,})@@ -340,12 +340,12 @@ fn drain_results(data.git_operation = git_operation;}}- TaskResult::UserStatus {+ TaskResult::UserMarker {item_idx,- user_status,+ user_marker,} => {// Store for status_symbols computation- status_contexts[item_idx].user_status = user_status;+ status_contexts[item_idx].user_marker = user_marker;}TaskResult::Upstream { item_idx, upstream } => {items[item_idx].upstream = Some(upstream);@@ -740,7 +740,7 @@ pub fn collect(item.compute_status_symbols(item_default_branch,ctx.has_merge_tree_conflicts,- ctx.user_status.clone(),+ ctx.user_marker.clone(),ctx.working_tree_symbols.as_deref(),ctx.has_conflicts,);@@ -1019,7 +1019,7 @@ pub fn populate_items(item.compute_status_symbols(item_default_branch,ctx.has_merge_tree_conflicts,- ctx.user_status.clone(),+ ctx.user_marker.clone(),ctx.working_tree_symbols.as_deref(),ctx.has_conflicts,);diff --git a/src/commands/list/collect_progressive_impl.rs b/src/commands/list/collect_progressive_impl.rsindex 852475a1c..90c2fad75 100644--- a/src/commands/list/collect_progressive_impl.rs+++ b/src/commands/list/collect_progressive_impl.rs@@ -324,17 +324,17 @@ impl Task for GitOperationTask {}/// Task 8 (worktree only): User-defined status from git config-pub struct UserStatusTask;+pub struct UserMarkerTask;-impl Task for UserStatusTask {- const KIND: TaskKind = TaskKind::UserStatus;+impl Task for UserMarkerTask {+ const KIND: TaskKind = TaskKind::UserMarker;fn compute(ctx: TaskContext) -> TaskResult {let repo = Repository::at(&ctx.repo_path);- let user_status = repo.user_status(ctx.branch.as_deref());- TaskResult::UserStatus {+ let user_marker = repo.user_marker(ctx.branch.as_deref());+ TaskResult::UserMarker {item_idx: ctx.item_idx,- user_status,+ user_marker,}}}@@ -461,7 +461,7 @@ pub fn collect_worktree_progressive(spawner.spawn::<WorkingTreeDiffTask>(s, &ctx);spawner.spawn::<MergeTreeConflictsTask>(s, &ctx);spawner.spawn::<GitOperationTask>(s, &ctx);- spawner.spawn::<UserStatusTask>(s, &ctx);+ spawner.spawn::<UserMarkerTask>(s, &ctx);spawner.spawn::<UpstreamTask>(s, &ctx);spawner.spawn::<CiStatusTask>(s, &ctx);});diff --git a/src/commands/list/layout.rs b/src/commands/list/layout.rsindex 5af291b2f..0cfb6aff2 100644--- a/src/commands/list/layout.rs+++ b/src/commands/list/layout.rs@@ -15,7 +15,7 @@//! - Empty positions render as single space for grid alignment//! - No leading spaces before the first symbol//!-//! Example with branch_state, working_tree, and user_status used:+//! Example with branch_state, working_tree, and user_marker used://! ```text//! Row 1: "β‘ π€" (branch=β‘, working=space, user=π€)//! Row 2: "β‘?! " (branch=β‘, working=?!, user=space)@@ -35,11 +35,11 @@//!//! **Single canonical system:**//! - One alignment mechanism for all status indicators-//! - User status treated consistently with git symbols+//! - User marker treated consistently with git symbols//!//! **Eliminates wasted space:**//! - Position mask removes columns for symbols that appear in zero rows-//! - User status only takes space when present+//! - User marker only takes space when present//!//! **Maintains alignment:**//! - All symbols align vertically at their positions (vertical scannability)diff --git a/src/commands/list/model.rs b/src/commands/list/model.rsindex 6a156ae04..bdf5bb4fd 100644--- a/src/commands/list/model.rs+++ b/src/commands/list/model.rs@@ -428,7 +428,7 @@ impl ListItem {&mut self,default_branch: Option<&str>,has_merge_tree_conflicts: bool,- user_status: Option<String>,+ user_marker: Option<String>,working_tree_symbols: Option<&str>,has_conflicts: bool,) {@@ -491,7 +491,7 @@ impl ListItem {main_divergence,upstream_divergence,working_tree: working_tree_symbols.unwrap_or("").to_string(),- user_status,+ user_marker,});}ItemKind::Branch => {@@ -518,7 +518,7 @@ impl ListItem {main_divergence,upstream_divergence,working_tree: String::new(),- user_status,+ user_marker,});}}@@ -856,7 +856,7 @@ pub enum GitOperationState {/// 1. Only allocate space for positions that have data/// 2. Pad each position to a consistent width for vertical alignment///-/// Stores maximum character width for each of 8 positions (including user status).+/// Stores maximum character width for each of 8 positions (including user marker)./// A width of 0 means the position is unused.#[derive(Debug, Clone, Copy, Default)]pub struct PositionMask {@@ -875,7 +875,7 @@ impl PositionMask {const MAIN_DIVERGENCE: usize = 4;const UPSTREAM_DIVERGENCE: usize = 5;const WORKTREE_STATE: usize = 6;- const USER_STATUS: usize = 7;+ const USER_MARKER: usize = 7;/// Full mask with all positions enabled (for JSON output and progressive rendering)/// Allocates realistic widths based on common symbol sizes to ensure proper grid alignment@@ -888,7 +888,7 @@ impl PositionMask {1, // MAIN_DIVERGENCE: ^, β, β, β (1 char)1, // UPSTREAM_DIVERGENCE: β‘, β£, β (1 char)1, // WORKTREE_STATE: β for branches, ββ«β for worktrees (priority: path_mismatch > prunable > locked)- 2, // USER_STATUS: single emoji or two chars (allocate 2)+ 2, // USER_MARKER: single emoji or two chars (allocate 2)],};@@ -906,7 +906,7 @@ impl PositionMask {/// - Main divergence: ^, β, β, β/// - Upstream divergence: β‘, β£, β/// - Worktree state: β for branches, ββ«β for worktrees (priority-only)-/// - User status: custom labels, emoji+/// - User marker: custom labels, emoji////// ## Mutual Exclusivity///@@ -948,7 +948,7 @@ pub struct StatusSymbols {pub(crate) working_tree: String,/// User-defined status annotation (custom labels, e.g., π¬, π€)- pub(crate) user_status: Option<String>,+ pub(crate) user_marker: Option<String>,}impl StatusSymbols {@@ -999,7 +999,7 @@ impl StatusSymbols {&& self.main_divergence == MainDivergence::None&& self.upstream_divergence == UpstreamDivergence::None&& self.working_tree.is_empty()- && self.user_status.is_none()+ && self.user_marker.is_none()}/// Render status symbols in compact form for statusline (no grid alignment).@@ -1016,7 +1016,7 @@ impl StatusSymbols {////// Returns: `[(position_mask, styled_string, has_data); 8]`///- /// Order: working_tree (+!?) β branch_op_state β main_divergence β upstream_divergence β worktree_state β user_status+ /// Order: working_tree (+!?) β branch_op_state β main_divergence β upstream_divergence β worktree_state β user_marker////// Styling follows semantic meaning:/// - Cyan: Working tree changes (activity indicator)@@ -1058,7 +1058,7 @@ impl StatusSymbols {_ => cformat!("<yellow>{}</>", self.worktree_state),};- let user_status_str = self.user_status.as_deref().unwrap_or("").to_string();+ let user_marker_str = self.user_marker.as_deref().unwrap_or("").to_string();// CRITICAL: Display order is working_tree first (staged, modified, untracked), then other symbols.// NEVER change this order - it ensures progressive and final rendering match exactly.@@ -1087,9 +1087,9 @@ impl StatusSymbols {self.worktree_state != WorktreeState::None,),(- PositionMask::USER_STATUS,- user_status_str,- self.user_status.is_some(),+ PositionMask::USER_MARKER,+ user_marker_str,+ self.user_marker.is_some(),),]}@@ -1128,7 +1128,7 @@ struct QueryableStatus {upstream_divergence: &'static str,worktree_state: &'static str,#[serde(skip_serializing_if = "Option::is_none")]- user_status: Option<String>,+ user_marker: Option<String>,}/// Status symbols (for display)@@ -1142,7 +1142,7 @@ struct DisplaySymbols {upstream_divergence: String,worktree_state: String,#[serde(skip_serializing_if = "Option::is_none")]- user_status: Option<String>,+ user_marker: Option<String>,}impl serde::Serialize for StatusSymbols {@@ -1167,7 +1167,7 @@ impl serde::Serialize for StatusSymbols {main_divergence: main_divergence_variant,upstream_divergence: upstream_divergence_variant,worktree_state: worktree_state_variant,- user_status: self.user_status.clone(),+ user_marker: self.user_marker.clone(),};let display_symbols = DisplaySymbols {@@ -1176,7 +1176,7 @@ impl serde::Serialize for StatusSymbols {main_divergence: self.main_divergence.to_string(),upstream_divergence: self.upstream_divergence.to_string(),worktree_state: self.worktree_state.to_string(),- user_status: self.user_status.clone(),+ user_marker: self.user_marker.clone(),};state.serialize_field("status", &queryable_status)?;diff --git a/src/commands/list/render.rs b/src/commands/list/render.rsindex c68b00bdd..20579618c 100644--- a/src/commands/list/render.rs+++ b/src/commands/list/render.rs@@ -1103,7 +1103,7 @@ mod tests {"Unicode and ASCII status should pad to same visual width");- // Case 3: Complex status with multiple emoji (git symbols + user status)+ // Case 3: Complex status with multiple emoji (git symbols + user marker)let complex_status = "ββ‘π€π";// β (1) + β‘ (1) + π€ (2) + π (2) = 6 visual columnsassert_eq!(diff --git a/src/commands/list/timing.rs b/src/commands/list/timing.rsindex 22f1024f7..a72f6474b 100644--- a/src/commands/list/timing.rs+++ b/src/commands/list/timing.rs@@ -21,7 +21,7 @@ pub enum OpName {// TODO(timing): Add PrStatus timing when CI/PR status collection is instrumentedPrStatus,MergeConflicts,- UserStatus,+ UserMarker,}/// Collects timing data for list operations.diff --git a/src/commands/mod.rs b/src/commands/mod.rsindex 588a924a0..e10718cd2 100644--- a/src/commands/mod.rs+++ b/src/commands/mod.rs@@ -19,7 +19,7 @@ pub mod worktree;pub use config::{handle_cache_clear, handle_cache_refresh, handle_cache_show, handle_config_create,- handle_config_show, handle_config_status_set, handle_config_status_unset,+ handle_config_show, handle_var_clear, handle_var_get, handle_var_set,};pub use configure_shell::{ConfigAction, handle_configure_shell, handle_unconfigure_shell};pub use init::handle_init;diff --git a/src/git/repository/mod.rs b/src/git/repository/mod.rsindex bc76ac216..14eff0e53 100644--- a/src/git/repository/mod.rs+++ b/src/git/repository/mod.rs@@ -271,18 +271,18 @@ impl Repository {})}- /// Read a user-defined status from `worktrunk.status.<branch>` in git config.- pub fn branch_keyed_status(&self, branch: &str) -> Option<String> {- let config_key = format!("worktrunk.status.{}", branch);+ /// Read a user-defined marker from `worktrunk.marker.<branch>` in git config.+ pub fn branch_keyed_marker(&self, branch: &str) -> Option<String> {+ let config_key = format!("worktrunk.marker.{}", branch);self.run_command(&["config", "--get", &config_key]).ok().map(|output| output.trim().to_string()).filter(|s| !s.is_empty())}- /// Read user-defined branch-keyed status.- pub fn user_status(&self, branch: Option<&str>) -> Option<String> {- branch.and_then(|branch| self.branch_keyed_status(branch))+ /// Read user-defined branch-keyed marker.+ pub fn user_marker(&self, branch: Option<&str>) -> Option<String> {+ branch.and_then(|branch| self.branch_keyed_marker(branch))}/// Record the previous branch in worktrunk.history for `wt switch -` support.diff --git a/src/main.rs b/src/main.rsindex 74e93494a..a9f80f264 100644--- a/src/main.rs+++ b/src/main.rs@@ -25,18 +25,18 @@ use commands::handle_select;use commands::worktree::{SwitchResult, handle_push};use commands::{ConfigAction, RebaseResult, SquashResult, handle_cache_clear, handle_cache_refresh,- handle_cache_show, handle_config_create, handle_config_show, handle_config_status_set,- handle_config_status_unset, handle_configure_shell, handle_init, handle_list, handle_merge,- handle_rebase, handle_remove, handle_remove_by_path, handle_remove_current, handle_squash,- handle_standalone_add_approvals, handle_standalone_clear_approvals, handle_standalone_commit,- handle_standalone_run_hook, handle_switch, handle_unconfigure_shell,+ handle_cache_show, handle_config_create, handle_config_show, handle_configure_shell,+ handle_init, handle_list, handle_merge, handle_rebase, handle_remove, handle_remove_by_path,+ handle_remove_current, handle_squash, handle_standalone_add_approvals,+ handle_standalone_clear_approvals, handle_standalone_commit, handle_standalone_run_hook,+ handle_switch, handle_unconfigure_shell, handle_var_clear, handle_var_get, handle_var_set,resolve_worktree_path_first,};use output::{execute_user_command, handle_remove_output, handle_switch_output};use cli::{ApprovalsCommand, CacheCommand, Cli, Commands, ConfigCommand, ConfigShellCommand,- ListSubcommand, StatusAction, StepCommand,+ ListSubcommand, StepCommand, VarCommand,};use worktrunk::HookType;@@ -530,9 +530,14 @@ fn main() {CacheCommand::Clear { cache_type } => handle_cache_clear(cache_type),CacheCommand::Refresh => handle_cache_refresh(),},- ConfigCommand::Status { action } => match action {- StatusAction::Set { value, branch } => handle_config_status_set(value, branch),- StatusAction::Unset { target } => handle_config_status_unset(target),+ ConfigCommand::Var { action } => match action {+ VarCommand::Get {+ key,+ refresh,+ branch,+ } => handle_var_get(&key, refresh, branch),+ VarCommand::Set { key, value, branch } => handle_var_set(&key, value, branch),+ VarCommand::Clear { key, branch, all } => handle_var_clear(&key, branch, all),},ConfigCommand::Approvals { action } => match action {ApprovalsCommand::Add { force, all } => handle_standalone_add_approvals(force, all),diff --git a/tests/integration_tests/config_status.rs b/tests/integration_tests/config_status.rsdeleted file mode 100644index 4d25aae24..000000000--- a/tests/integration_tests/config_status.rs+++ /dev/null@@ -1,139 +0,0 @@-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.stderr), @"β [32mSet status for [1mmain[22m to [1mπ§[22m[39m");-- // 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.stderr), @"β [32mSet status for [1mfeature[22m to [1mπ§[22m[39m");-- // 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.stderr), @"β [32mCleared status for [1mmain[22m[39m");-- // 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.stderr), @"β [32mCleared status for [1mfeature[22m[39m");-- // 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.stderr), @"β [32mCleared [1m3[22m statuses[39m");-- // 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.stderr), @"βͺ No statuses to clear");-}diff --git a/tests/integration_tests/config_var.rs b/tests/integration_tests/config_var.rsnew file mode 100644index 000000000..12fcd9fe2--- /dev/null+++ b/tests/integration_tests/config_var.rs@@ -0,0 +1,264 @@+use crate::common::{TestRepo, wt_command};+use insta::assert_snapshot;+use std::process::Command;++fn wt_var_set_cmd(repo: &TestRepo, args: &[&str]) -> Command {+ let mut cmd = wt_command();+ repo.clean_cli_env(&mut cmd);+ cmd.args(["config", "var", "set"]);+ cmd.args(args);+ cmd.current_dir(repo.root_path());+ cmd+}++fn wt_var_clear_cmd(repo: &TestRepo, args: &[&str]) -> Command {+ let mut cmd = wt_command();+ repo.clean_cli_env(&mut cmd);+ cmd.args(["config", "var", "clear"]);+ cmd.args(args);+ cmd.current_dir(repo.root_path());+ cmd+}++fn wt_var_get_cmd(repo: &TestRepo, args: &[&str]) -> Command {+ let mut cmd = wt_command();+ repo.clean_cli_env(&mut cmd);+ cmd.args(["config", "var", "get"]);+ cmd.args(args);+ cmd.current_dir(repo.root_path());+ cmd+}++#[test]+fn test_var_set_marker_branch_default() {+ let repo = TestRepo::new();+ repo.commit("Initial commit");++ let output = wt_var_set_cmd(&repo, &["marker", "π§"]).output().unwrap();+ assert!(output.status.success());+ assert_snapshot!(String::from_utf8_lossy(&output.stderr), @"β [32mSet marker for [1mmain[22m to [1mπ§[22m[39m");++ // Verify it was set+ let output = repo+ .git_command(&["config", "--get", "worktrunk.marker.main"])+ .output()+ .unwrap();+ assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "π§");+}++#[test]+fn test_var_set_marker_branch_specific() {+ let repo = TestRepo::new();+ repo.commit("Initial commit");+ repo.git_command(&["branch", "feature"]).status().unwrap();++ let output = wt_var_set_cmd(&repo, &["marker", "π§", "--branch", "feature"])+ .output()+ .unwrap();+ assert!(output.status.success());+ assert_snapshot!(String::from_utf8_lossy(&output.stderr), @"β [32mSet marker for [1mfeature[22m to [1mπ§[22m[39m");++ // Verify it was set+ let output = repo+ .git_command(&["config", "--get", "worktrunk.marker.feature"])+ .output()+ .unwrap();+ assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "π§");+}++#[test]+fn test_var_clear_marker_branch_default() {+ let repo = TestRepo::new();+ repo.commit("Initial commit");++ // Set a marker first+ repo.git_command(&["config", "worktrunk.marker.main", "π§"])+ .status()+ .unwrap();++ let output = wt_var_clear_cmd(&repo, &["marker"]).output().unwrap();+ assert!(output.status.success());+ assert_snapshot!(String::from_utf8_lossy(&output.stderr), @"β [32mCleared marker for [1mmain[22m[39m");++ // Verify it was unset+ let output = repo+ .git_command(&["config", "--get", "worktrunk.marker.main"])+ .output()+ .unwrap();+ assert!(!output.status.success());+}++#[test]+fn test_var_clear_marker_branch_specific() {+ let repo = TestRepo::new();+ repo.commit("Initial commit");++ // Set a marker first+ repo.git_command(&["config", "worktrunk.marker.feature", "π§"])+ .status()+ .unwrap();++ let output = wt_var_clear_cmd(&repo, &["marker", "--branch", "feature"])+ .output()+ .unwrap();+ assert!(output.status.success());+ assert_snapshot!(String::from_utf8_lossy(&output.stderr), @"β [32mCleared marker for [1mfeature[22m[39m");++ // Verify it was unset+ let output = repo+ .git_command(&["config", "--get", "worktrunk.marker.feature"])+ .output()+ .unwrap();+ assert!(!output.status.success());+}++#[test]+fn test_var_clear_marker_all() {+ let repo = TestRepo::new();+ repo.commit("Initial commit");++ // Set multiple markers+ repo.git_command(&["config", "worktrunk.marker.main", "π§"])+ .status()+ .unwrap();+ repo.git_command(&["config", "worktrunk.marker.feature", "π§"])+ .status()+ .unwrap();+ repo.git_command(&["config", "worktrunk.marker.bugfix", "π"])+ .status()+ .unwrap();++ let output = wt_var_clear_cmd(&repo, &["marker", "--all"])+ .output()+ .unwrap();+ assert!(output.status.success());+ assert_snapshot!(String::from_utf8_lossy(&output.stderr), @"β [32mCleared [1m3[22m markers[39m");++ // Verify all were unset+ let output = repo+ .git_command(&["config", "--get-regexp", "^worktrunk\\.marker\\."])+ .output()+ .unwrap();+ assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "");+}++#[test]+fn test_var_clear_marker_all_empty() {+ let repo = TestRepo::new();+ repo.commit("Initial commit");++ let output = wt_var_clear_cmd(&repo, &["marker", "--all"])+ .output()+ .unwrap();+ assert!(output.status.success());+ assert_snapshot!(String::from_utf8_lossy(&output.stderr), @"βͺ No markers to clear");+}++#[test]+fn test_var_get_marker() {+ let repo = TestRepo::new();+ repo.commit("Initial commit");++ // Set a marker first+ repo.git_command(&["config", "worktrunk.marker.main", "π§"])+ .status()+ .unwrap();++ let output = wt_var_get_cmd(&repo, &["marker"]).output().unwrap();+ assert!(output.status.success());+ // data() writes to stdout for piping+ assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "π§");+}++#[test]+fn test_var_get_marker_empty() {+ let repo = TestRepo::new();+ repo.commit("Initial commit");++ let output = wt_var_get_cmd(&repo, &["marker"]).output().unwrap();+ assert!(output.status.success());+ // Empty output when no marker is set+ assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "");+}++#[test]+fn test_var_get_marker_specific_branch() {+ let repo = TestRepo::new();+ repo.commit("Initial commit");+ repo.git_command(&["branch", "feature"]).status().unwrap();++ // Set a marker for feature branch+ repo.git_command(&["config", "worktrunk.marker.feature", "π§"])+ .status()+ .unwrap();++ let output = wt_var_get_cmd(&repo, &["marker", "--branch", "feature"])+ .output()+ .unwrap();+ assert!(output.status.success());+ // data() writes to stdout for piping+ assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "π§");+}++#[test]+fn test_var_get_default_branch() {+ let mut repo = TestRepo::new();+ repo.commit("Initial commit");+ repo.setup_remote("main");++ let output = wt_var_get_cmd(&repo, &["default-branch"]).output().unwrap();+ assert!(output.status.success());+ // data() writes to stdout for piping+ assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "main");+}++#[test]+fn test_var_get_default_branch_no_remote() {+ let repo = TestRepo::new();+ repo.commit("Initial commit");++ // Without remote, should infer from local branches+ let output = wt_var_get_cmd(&repo, &["default-branch"]).output().unwrap();+ assert!(output.status.success());+ // Should return the current branch name (main)+ assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "main");+}++#[test]+fn test_var_get_ci_status() {+ let repo = TestRepo::new();+ repo.commit("Initial commit");++ // Without any CI configured, should return "noci"+ let output = wt_var_get_cmd(&repo, &["ci-status"]).output().unwrap();+ assert!(output.status.success());+ assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "noci");+}++#[test]+fn test_var_get_ci_status_specific_branch() {+ let repo = TestRepo::new();+ repo.commit("Initial commit");+ repo.git_command(&["branch", "feature"]).status().unwrap();++ // Without any CI configured, should return "noci"+ let output = wt_var_get_cmd(&repo, &["ci-status", "--branch", "feature"])+ .output()+ .unwrap();+ assert!(output.status.success());+ assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "noci");+}++#[test]+fn test_var_get_ci_status_nonexistent_branch() {+ let repo = TestRepo::new();+ repo.commit("Initial commit");++ // Should error for nonexistent branch+ let output = wt_var_get_cmd(&repo, &["ci-status", "--branch", "nonexistent"])+ .output()+ .unwrap();+ assert!(!output.status.success());+ let stderr = String::from_utf8_lossy(&output.stderr);+ assert!(stderr.contains("not found") || stderr.contains("nonexistent"));+}diff --git a/tests/integration_tests/help.rs b/tests/integration_tests/help.rsindex 698f97827..50595e4be 100644--- a/tests/integration_tests/help.rs+++ b/tests/integration_tests/help.rs@@ -124,18 +124,25 @@ fn help_config_show() {}#[test]-fn help_config_status_set() {- snapshot_help(- "help_config_status_set",- &["config", "status", "set", "--help"],- );+fn help_config_var() {+ snapshot_help("help_config_var", &["config", "var", "--help"]);+}++#[test]+fn help_config_var_get() {+ snapshot_help("help_config_var_get", &["config", "var", "get", "--help"]);+}++#[test]+fn help_config_var_set() {+ snapshot_help("help_config_var_set", &["config", "var", "set", "--help"]);}#[test]-fn help_config_status_unset() {+fn help_config_var_clear() {snapshot_help(- "help_config_status_unset",- &["config", "status", "unset", "--help"],+ "help_config_var_clear",+ &["config", "var", "clear", "--help"],);}diff --git a/tests/integration_tests/list.rs b/tests/integration_tests/list.rsindex 539001530..511486110 100644--- a/tests/integration_tests/list.rs+++ b/tests/integration_tests/list.rs@@ -766,11 +766,11 @@ fn test_list_primary_on_different_branch() {}#[test]-fn test_list_with_user_status() {+fn test_list_with_user_marker() {let mut repo = TestRepo::new();repo.commit_with_age("Initial commit", DAY);- // Branch ahead of main with commits and user status π€+ // Branch ahead of main with commits and user marker π€let feature_wt = repo.add_worktree("feature-api");std::fs::write(feature_wt.join("api.rs"), "// API implementation").unwrap();let mut cmd = Command::new("git");@@ -785,15 +785,15 @@ fn test_list_with_user_status() {.current_dir(&feature_wt).output().unwrap();- // Set user status+ // Set user markerlet mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.feature-api", "π€"])+ cmd.args(["config", "worktrunk.marker.feature-api", "π€"]).current_dir(repo.root_path()).output().unwrap();- // Branch with uncommitted changes and user status π¬+ // Branch with uncommitted changes and user marker π¬let review_wt = repo.add_worktree("review-ui");std::fs::write(review_wt.join("component.tsx"), "// UI component").unwrap();let mut cmd = Command::new("git");@@ -810,41 +810,41 @@ fn test_list_with_user_status() {.unwrap();// Add uncommitted changesstd::fs::write(review_wt.join("styles.css"), "/* pending styles */").unwrap();- // Set user status+ // Set user markerlet mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.review-ui", "π¬"])+ cmd.args(["config", "worktrunk.marker.review-ui", "π¬"]).current_dir(repo.root_path()).output().unwrap();- // Branch with uncommitted changes only (no user status)+ // Branch with uncommitted changes only (no user marker)let wip_wt = repo.add_worktree("wip-docs");std::fs::write(wip_wt.join("README.md"), "# Documentation").unwrap();- snapshot_list("with_user_status", &repo);+ snapshot_list("with_user_marker", &repo);}#[test]-fn test_list_json_with_user_status() {+fn test_list_json_with_user_marker() {let mut repo = TestRepo::new();repo.commit_with_age("Initial commit", DAY);- // Worktree with user status (emoji only)+ // Worktree with user marker (emoji only)repo.add_worktree("with-status");- // Set user status (branch-keyed)+ // Set user marker (branch-keyed)let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.with-status", "π§"])+ cmd.args(["config", "worktrunk.marker.with-status", "π§"]).current_dir(repo.root_path()).output().unwrap();- // Worktree without user status+ // Worktree without user markerrepo.add_worktree("without-status");- snapshot_list_json("json_with_user_status", &repo);+ snapshot_list_json("json_with_user_marker", &repo);}#[test]@@ -937,7 +937,7 @@ fn test_list_branch_only_with_status() {// Set branch-keyed status for the branch-only entrylet mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.branch-only", "πΏ"])+ cmd.args(["config", "worktrunk.marker.branch-only", "πΏ"]).current_dir(repo.root_path()).output().unwrap();@@ -947,7 +947,7 @@ fn test_list_branch_only_with_status() {}#[test]-fn test_list_user_status_with_special_characters() {+fn test_list_user_marker_with_special_characters() {let mut repo = TestRepo::new();repo.commit("Initial commit");@@ -956,7 +956,7 @@ fn test_list_user_status_with_special_characters() {let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.emoji", "π"])+ cmd.args(["config", "worktrunk.marker.emoji", "π"]).current_dir(repo.root_path()).output().unwrap();@@ -966,12 +966,12 @@ fn test_list_user_status_with_special_characters() {let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.multi", "π¨βπ»"])+ cmd.args(["config", "worktrunk.marker.multi", "π¨βπ»"]).current_dir(repo.root_path()).output().unwrap();- snapshot_list("user_status_special_chars", &repo);+ snapshot_list("user_marker_special_chars", &repo);}/// Generate README example: List output for Quick Start narrative@@ -1424,10 +1424,10 @@ fn test_list_large_diffs_alignment() {.join("\n");std::fs::write(large_wt.join("another.txt"), &another_large).unwrap();- // Set user status+ // Set user markerlet mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.feature-changes", "π€"])+ cmd.args(["config", "worktrunk.marker.feature-changes", "π€"]).current_dir(repo.root_path()).output().unwrap();@@ -1436,10 +1436,10 @@ fn test_list_large_diffs_alignment() {let short_wt = repo.add_worktree("fix");std::fs::write(short_wt.join("quick.txt"), "quick fix").unwrap();- // Set user status for short branch+ // Set user marker for short branchlet mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.fix", "π¬"])+ cmd.args(["config", "worktrunk.marker.fix", "π¬"]).current_dir(repo.root_path()).output().unwrap();@@ -1473,10 +1473,10 @@ fn test_list_large_diffs_alignment() {.join("\n");std::fs::write(diverged_wt.join("test.txt"), &modified_diverged).unwrap();- // Set user status+ // Set user markerlet mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.diverged", "π¬"])+ cmd.args(["config", "worktrunk.marker.diverged", "π¬"]).current_dir(repo.root_path()).output().unwrap();@@ -1528,10 +1528,10 @@ fn test_list_status_column_padding_with_emoji() {.join("\n");std::fs::write(wli_seq.join("new.txt"), &new_content).unwrap();- // Set user status emoji π€+ // Set user marker emoji π€let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.wli-sequence", "π€"])+ cmd.args(["config", "worktrunk.marker.wli-sequence", "π€"]).current_dir(repo.root_path()).output().unwrap();@@ -1557,7 +1557,7 @@ fn test_list_status_column_padding_with_emoji() {// Set same emoji typelet mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.pr-link", "π€"])+ cmd.args(["config", "worktrunk.marker.pr-link", "π€"]).current_dir(repo.root_path()).output().unwrap();@@ -1580,7 +1580,7 @@ fn test_list_status_column_padding_with_emoji() {let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.main-symbol", "π¬"])+ cmd.args(["config", "worktrunk.marker.main-symbol", "π¬"]).current_dir(repo.root_path()).output().unwrap();@@ -1656,7 +1656,7 @@ fn test_list_maximum_working_tree_symbols() {#[test]fn test_list_maximum_status_with_git_operation() {// Test maximum status symbols including git operation (rebase/merge):- // ?!+ (working_tree) + = (conflicts) + β» (rebase) + β (diverged) + β (locked) + π€ (user status)+ // ?!+ (working_tree) + = (conflicts) + β» (rebase) + β (diverged) + β (locked) + π€ (user marker)// This pushes the Status column to ~10-11 chars of actual contentlet mut repo = TestRepo::new();@@ -1751,15 +1751,15 @@ fn test_list_maximum_status_with_git_operation() {.output().unwrap();- // Set user status emoji (π€)+ // Set user marker emoji (π€)let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.feature", "π€"])+ cmd.args(["config", "worktrunk.marker.feature", "π€"]).current_dir(repo.root_path()).output().unwrap();- // Result should show: ?!+ (working_tree) + = (conflicts) + β» (rebase) + β (diverged) + β (locked) + π€ (user status)+ // Result should show: ?!+ (working_tree) + = (conflicts) + β» (rebase) + β (diverged) + β (locked) + π€ (user marker)// Use --full to enable conflict detectionlet settings = list_snapshots::standard_settings(&repo);settings.bind(|| {@@ -1918,10 +1918,10 @@ fn test_list_maximum_status_symbols() {.output().unwrap();- // Set user status emoji (π€)+ // Set user marker emoji (π€)let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.feature", "π€"])+ cmd.args(["config", "worktrunk.marker.feature", "π€"]).current_dir(repo.root_path()).output().unwrap();diff --git a/tests/integration_tests/list_pty.rs b/tests/integration_tests/list_pty.rsindex f09366966..c5ae50c17 100644--- a/tests/integration_tests/list_pty.rs+++ b/tests/integration_tests/list_pty.rs@@ -117,7 +117,7 @@ fn normalize_pty_output(output: &str) -> String {}// Flaky: PTY progressive rendering has timing-dependent output that changes between runs.-// The non-PTY tests already verify status column rendering with emoji user status.+// The non-PTY tests already verify status column rendering with emoji user marker.#[test]#[ignore]fn test_list_pty_status_column_padding_with_emoji() {@@ -163,9 +163,9 @@ fn test_list_pty_status_column_padding_with_emoji() {// Add untracked and modified files for Status symbolsstd::fs::write(wli_seq.join("untracked.txt"), "new file").unwrap();- // Set user status emoji for wli-sequence+ // Set user marker emoji for wli-sequencerepo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.wli-sequence", "π€"])+ cmd.args(["config", "worktrunk.marker.wli-sequence", "π€"]).current_dir(repo.root_path()).output().unwrap();@@ -185,7 +185,7 @@ fn test_list_pty_status_column_padding_with_emoji() {.unwrap();repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.pr-link", "π€"])+ cmd.args(["config", "worktrunk.marker.pr-link", "π€"]).current_dir(repo.root_path()).output().unwrap();@@ -205,7 +205,7 @@ fn test_list_pty_status_column_padding_with_emoji() {.unwrap();repo.configure_git_cmd(&mut cmd);- cmd.args(["config", "worktrunk.status.main-symbol", "π¬"])+ cmd.args(["config", "worktrunk.marker.main-symbol", "π¬"]).current_dir(repo.root_path()).output().unwrap();diff --git a/tests/integration_tests/mod.rs b/tests/integration_tests/mod.rsindex 09a4b6bec..aa8e6e82a 100644--- a/tests/integration_tests/mod.rs+++ b/tests/integration_tests/mod.rs@@ -14,7 +14,7 @@ pub mod completion_validation;pub mod config_cache;pub mod config_init;pub mod config_show;-pub mod config_status;+pub mod config_var;pub mod configure_shell;pub mod default_branch;pub mod directives;diff --git a/tests/snapshots/integration__integration_tests__help__help_config_long.snap b/tests/snapshots/integration__integration_tests__help__help_config_long.snapindex bbe462d54..3a4b992e7 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_long.snap@@ -25,7 +25,7 @@ Usage: [1m[36mwt config[0m [36m[OPTIONS][0m [36m<COMMAND>[0m[1m[36mcreate[0m Create user configuration file[1m[36mshow[0m Show configuration files & locations[1m[36mcache[0m Manage caches (CI status, default branch)- [1m[36mstatus[0m Manage branch status markers+ [1m[36mvar[0m Get or set runtime variables (stored in git config)[1m[36mapprovals[0m Manage command approvals[1m[32mOptions:[0mdiff --git a/tests/snapshots/integration__integration_tests__help__help_config_short.snap b/tests/snapshots/integration__integration_tests__help__help_config_short.snapindex 721095006..b0c876f31 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_short.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_short.snap@@ -25,7 +25,7 @@ Usage: [1m[36mwt config[0m [36m[OPTIONS][0m [36m<COMMAND>[0m[1m[36mcreate[0m Create user configuration file[1m[36mshow[0m Show configuration files & locations[1m[36mcache[0m Manage caches (CI status, default branch)- [1m[36mstatus[0m Manage branch status markers+ [1m[36mvar[0m Get or set runtime variables (stored in git config)[1m[36mapprovals[0m Manage command approvals[1m[32mOptions:[0mdiff --git a/tests/snapshots/integration__integration_tests__help__help_config_var.snap b/tests/snapshots/integration__integration_tests__help__help_config_var.snapnew file mode 100644index 000000000..c69cf1c77--- /dev/null+++ b/tests/snapshots/integration__integration_tests__help__help_config_var.snap@@ -0,0 +1,60 @@+---+source: tests/integration_tests/help.rs+info:+ program: wt+ args:+ - config+ - var+ - "--help"+ env:+ CLICOLOR_FORCE: "1"+ COLUMNS: "150"+ GIT_EDITOR: ""+ SOURCE_DATE_EPOCH: "1735776000"+ WORKTRUNK_CONFIG_PATH: /nonexistent/test/config.toml+---+success: true+exit_code: 0+----- stdout -----++----- stderr -----+wt config var - Get or set runtime variables (stored in git config)+Usage: [1m[36mwt config var[0m [36m[OPTIONS][0m [36m<COMMAND>[0m++[1m[32mCommands:[0m+ [1m[36mget[0m Get a variable value+ [1m[36mset[0m Set a variable value+ [1m[36mclear[0m Clear a variable value++[1m[32mOptions:[0m+ [1m[36m-h[0m, [1m[36m--help[0m+ Print help (see a summary with '-h')++[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 info++Variables are runtime values stored in git config, separate from+configuration files. Use [2mwt config show[0m to view file-based configuration.++[32mAvailable Variables[0m++- [1mdefault-branch[0m: The repository's default branch (read-only, cached)+- [1mmarker[0m: Custom status marker for a branch (shown in [2mwt list[0m)++[32mExamples[0m++Get the default branch:+ [2mwt config var get default-branch[0m++Set a marker for current branch:+ [2mwt config var set marker "π§ WIP"[0m++Clear markers:+ [2mwt config var clear marker --all[0mdiff --git a/tests/snapshots/integration__integration_tests__help__help_config_status_unset.snap b/tests/snapshots/integration__integration_tests__help__help_config_var_clear.snapsimilarity index 52%rename from tests/snapshots/integration__integration_tests__help__help_config_status_unset.snaprename to tests/snapshots/integration__integration_tests__help__help_config_var_clear.snapindex c3eaa70ee..d5d3d80bb 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_status_unset.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_var_clear.snap@@ -4,8 +4,8 @@ info:program: wtargs:- config- - status- - unset+ - var+ - clear- "--help"env:CLICOLOR_FORCE: "1"@@ -19,16 +19,22 @@ exit_code: 0----- stdout ---------- stderr ------wt config status unset - Clear status emoji-Usage: [1m[36mwt config status unset[0m [36m[OPTIONS][0m [36m[TARGET][0m+wt config var clear - Clear a variable value+Usage: [1m[36mwt config var clear[0m [36m[OPTIONS][0m [36m<KEY>[0m[1m[32mArguments:[0m- [36m[TARGET][0m- Branch or '*' for all+ [36m<KEY>[0m+ Variable: 'marker'- [default: ]+ [possible values: marker][1m[32mOptions:[0m+ [1m[36m--branch[0m[36m [0m[36m<BRANCH>[0m+ Target branch (defaults to current)++ [1m[36m--all[0m+ Clear all values+[1m[36m-h[0m, [1m[36m--help[0mPrint help (see a summary with '-h')@@ -42,4 +48,17 @@ Usage: [1m[36mwt config status unset[0m [36m[OPTIONS][0m [36m[TARGET][0m[1m[36m-v[0m, [1m[36m--verbose[0mShow commands and debug info-Removes status marker from branch(es). Use '*' to clear all statuses.+Variables:++- [1mmarker[0m: Custom status marker for a branch++[32mExamples[0m++Clear marker for current branch:+ [2mwt config var clear marker[0m++Clear marker for a specific branch:+ [2mwt config var clear marker --branch=feature[0m++Clear all markers:+ [2mwt config var clear marker --all[0mdiff --git a/tests/snapshots/integration__integration_tests__help__help_config_var_get.snap b/tests/snapshots/integration__integration_tests__help__help_config_var_get.snapnew file mode 100644index 000000000..f7dd94ea5--- /dev/null+++ b/tests/snapshots/integration__integration_tests__help__help_config_var_get.snap@@ -0,0 +1,75 @@+---+source: tests/integration_tests/help.rs+info:+ program: wt+ args:+ - config+ - var+ - get+ - "--help"+ env:+ CLICOLOR_FORCE: "1"+ COLUMNS: "150"+ GIT_EDITOR: ""+ SOURCE_DATE_EPOCH: "1735776000"+ WORKTRUNK_CONFIG_PATH: /nonexistent/test/config.toml+---+success: true+exit_code: 0+----- stdout -----++----- stderr -----+wt config var get - Get a variable value+Usage: [1m[36mwt config var get[0m [36m[OPTIONS][0m [36m<KEY>[0m++[1m[32mArguments:[0m+ [36m<KEY>[0m+ Variable: 'default-branch', 'marker', or 'ci-status'++ [possible values: default-branch, marker, ci-status]++[1m[32mOptions:[0m+ [1m[36m--refresh[0m+ Force refresh (for cached variables)++ [1m[36m--branch[0m[36m [0m[36m<BRANCH>[0m+ Target branch (for branch-scoped variables)++ [1m[36m-h[0m, [1m[36m--help[0m+ Print help (see a summary with '-h')++[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 info++Variables:++- [1mdefault-branch[0m: The repository's default branch (main, master, etc.)+- [1mmarker[0m: Custom status marker for a branch (shown in [2mwt list[0m)+- [1mci-status[0m: CI/PR status for a branch (passed, running, failed, conflicts, noci)++[32mExamples[0m++Get the default branch:+ [2mwt config var get default-branch[0m++Force refresh from remote:+ [2mwt config var get default-branch --refresh[0m++Get marker for current branch:+ [2mwt config var get marker[0m++Get marker for a specific branch:+ [2mwt config var get marker --branch=feature[0m++Get CI status for current branch:+ [2mwt config var get ci-status[0m++Force refresh CI status (bypass cache):+ [2mwt config var get ci-status --refresh[0mdiff --git a/tests/snapshots/integration__integration_tests__help__help_config_status_set.snap b/tests/snapshots/integration__integration_tests__help__help_config_var_set.snapsimilarity index 62%rename from tests/snapshots/integration__integration_tests__help__help_config_status_set.snaprename to tests/snapshots/integration__integration_tests__help__help_config_var_set.snapindex 94c8dae1d..7b2a1a6df 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_status_set.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_var_set.snap@@ -4,7 +4,7 @@ info:program: wtargs:- config- - status+ - var- set- "--help"env:@@ -19,12 +19,17 @@ exit_code: 0----- stdout ---------- stderr ------wt config status set - Set status emoji for branch-Usage: [1m[36mwt config status set[0m [36m[OPTIONS][0m [36m<VALUE>[0m+wt config var set - Set a variable value+Usage: [1m[36mwt config var set[0m [36m[OPTIONS][0m [36m<KEY>[0m [36m<VALUE>[0m[1m[32mArguments:[0m+ [36m<KEY>[0m+ Variable: 'marker'++ [possible values: marker]+[36m<VALUE>[0m- Status emoji to display+ Value to set[1m[32mOptions:[0m[1m[36m--branch[0m[36m [0m[36m<BRANCH>[0m@@ -43,7 +48,14 @@ Usage: [1m[36mwt config status set[0m [36m[OPTIONS][0m [36m<VALUE>[0m[1m[36m-v[0m, [1m[36m--verbose[0mShow commands and debug info-Sets a custom status marker that appears in [2mwt list[0m output.+Variables:++- [1mmarker[0m: Custom status marker displayed in [2mwt list[0m output++[32mExamples[0m++Set marker for current branch:+ [2mwt config var set marker "π§ WIP"[0m-Use emojis or short text to indicate work state (e.g., π§ WIP, β ready, π blocked).-Stored in git config under [2mworktrunk.status.<branch>[0m.+Set marker for a specific branch:+ [2mwt config var set marker "β ready" --branch=feature[0mdiff --git a/tests/snapshots/integration__integration_tests__help__help_list_long.snap b/tests/snapshots/integration__integration_tests__help__help_list_long.snapindex 2fdfd4c72..84f05a540 100644--- a/tests/snapshots/integration__integration_tests__help__help_list_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_list_long.snap@@ -115,7 +115,7 @@ with the same fields in the same order as Status Symbols above:- [2mgit_operation[0m: [2m""[0m | [2m"Rebase"[0m | [2m"Merge"[0m- [2mmain_divergence[0m: [2m""[0m | [2m"Ahead"[0m | [2m"Behind"[0m | [2m"Diverged"[0m- [2mupstream_divergence[0m: [2m""[0m | [2m"Ahead"[0m | [2m"Behind"[0m | [2m"Diverged"[0m-- [2muser_status[0m: string (optional)+- [2muser_marker[0m: string (optional)[1m`status_symbols`[0m - Unicode symbols for display (same fields, plus [2mworktree_attrs[0m: β/β«/β )diff --git a/tests/snapshots/integration__integration_tests__list__json_with_user_status.snap b/tests/snapshots/integration__integration_tests__list__json_with_user_marker.snapsimilarity index 98%rename from tests/snapshots/integration__integration_tests__list__json_with_user_status.snaprename to tests/snapshots/integration__integration_tests__list__json_with_user_marker.snapindex 8a3fb7df5..68bfc4bb6 100644--- a/tests/snapshots/integration__integration_tests__list__json_with_user_status.snap+++ b/tests/snapshots/integration__integration_tests__list__json_with_user_marker.snap@@ -100,7 +100,7 @@ exit_code: 0"main_divergence": "","upstream_divergence": "","worktree_state": "",- "user_status": "π§"+ "user_marker": "π§"},"status_symbols": {"working_tree": "",@@ -108,7 +108,7 @@ exit_code: 0"main_divergence": "","upstream_divergence": "","worktree_state": "",- "user_status": "π§"+ "user_marker": "π§"},"status_line": "with-status /u001b[2m_/u001b[22mπ§","type": "worktree",diff --git a/tests/snapshots/integration__integration_tests__list__user_status_special_chars.snap b/tests/snapshots/integration__integration_tests__list__user_marker_special_chars.snapsimilarity index 100%rename from tests/snapshots/integration__integration_tests__list__user_status_special_chars.snaprename to tests/snapshots/integration__integration_tests__list__user_marker_special_chars.snapdiff --git a/tests/snapshots/integration__integration_tests__list__with_user_status.snap b/tests/snapshots/integration__integration_tests__list__with_user_marker.snapsimilarity index 100%rename from tests/snapshots/integration__integration_tests__list__with_user_status.snaprename to tests/snapshots/integration__integration_tests__list__with_user_marker.snap