Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
refactor(commands): drop unused action label from CommandEnv constructors (#2186)
Worktrunk Botd6840c780d3a
diff --git a/src/commands/context.rs b/src/commands/context.rsindex c6a1acfa3..0a5e2899e 100644--- a/src/commands/context.rs+++ b/src/commands/context.rs@@ -30,7 +30,7 @@ impl CommandEnv {/// Resolves the worktree path from the current directory. The branch is/// populated when available but not required — commands that need a branch/// should call `require_branch()` after construction.- pub fn for_action(_action: &str, config: UserConfig) -> anyhow::Result<Self> {+ pub fn for_action(config: UserConfig) -> anyhow::Result<Self> {let repo = Repository::current()?;let current_wt = repo.current_worktree();let worktree_path = current_wt.root()?;@@ -50,7 +50,7 @@ impl CommandEnv {////// Resolves the worktree path from the branch name rather than using/// the current working directory.- pub fn for_branch(_action: &str, config: UserConfig, branch: &str) -> anyhow::Result<Self> {+ pub fn for_branch(config: UserConfig, branch: &str) -> anyhow::Result<Self> {let repo = Repository::current()?;let worktree_path = repo.worktree_for_branch(branch)?diff --git a/src/commands/merge.rs b/src/commands/merge.rsindex 3d59ccafc..98b70517d 100644--- a/src/commands/merge.rs+++ b/src/commands/merge.rs@@ -107,7 +107,7 @@ pub fn handle_merge(opts: MergeOptions<'_>) -> anyhow::Result<()> {let _ = crate::output::prompt_commit_generation(&mut config);}- let env = CommandEnv::for_action("merge", config)?;+ let env = CommandEnv::for_action(config)?;let repo = &env.repo;let config = &env.config;// Merge requires being on a branch (can't merge from detached HEAD)diff --git a/src/commands/step_commands.rs b/src/commands/step_commands.rsindex a99a40a36..05ad0c7bf 100644--- a/src/commands/step_commands.rs+++ b/src/commands/step_commands.rs@@ -72,8 +72,8 @@ pub fn step_commit(let _ = crate::output::prompt_commit_generation(&mut config);let env = match branch {- Some(ref b) => CommandEnv::for_branch("commit", config, b)?,- None => CommandEnv::for_action("commit", config)?,+ Some(ref b) => CommandEnv::for_branch(config, b)?,+ None => CommandEnv::for_action(config)?,};let ctx = env.context(yes);@@ -136,7 +136,7 @@ pub fn handle_squash(// One-time LLM setup prompt (errors logged internally; don't block commit)let _ = crate::output::prompt_commit_generation(&mut config);- let env = CommandEnv::for_action("squash", config)?;+ let env = CommandEnv::for_action(config)?;let repo = &env.repo;// Squash requires being on a branch (can't squash in detached HEAD)let current_branch = env.require_branch("squash")?.to_string();