Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
chore: small drift cleanups from nightly survey (#2549)
Worktrunk Botf2a7089dfe5b
diff --git a/src/cli/hook.rs b/src/cli/hook.rsindex f84d9476f..0fd5ac001 100644--- a/src/cli/hook.rs+++ b/src/cli/hook.rs@@ -40,6 +40,7 @@ use std::ffi::OsString;use anyhow::{Context, bail};use clap::Subcommand;+use clap::builder::PossibleValuesParser;use worktrunk::HookType;use super::config::ApprovalsCommand;@@ -74,7 +75,7 @@ pub enum HookCommand {/// Lists user and project hooks. Project hooks show approval status (❓ = needs approval).Show {/// Hook type to show (default: all)- #[arg(value_parser = ["pre-switch", "post-switch", "pre-start", "post-start", "pre-commit", "post-commit", "pre-merge", "post-merge", "pre-remove", "post-remove"])]+ #[arg(value_parser = PossibleValuesParser::new(HOOK_TYPE_NAMES))]hook_type: Option<String>,/// Show expanded commands with current variablesdiff --git a/src/commands/mod.rs b/src/commands/mod.rsindex 4d4aabfde..5e177548e 100644--- a/src/commands/mod.rs+++ b/src/commands/mod.rs@@ -72,8 +72,8 @@ use worktrunk::styling::{eprintln, format_with_gutter};/// Format command execution label with optional command name.////// Examples:-/// - `format_command_label("post-create", Some("install"))` → `"Running post-create install"` (with bold)-/// - `format_command_label("post-create", None)` → `"Running post-create"`+/// - `format_command_label("post-start", Some("install"))` → `"Running post-start install"` (with bold)+/// - `format_command_label("post-start", None)` → `"Running post-start"`pub(crate) fn format_command_label(command_type: &str, name: Option<&str>) -> String {match name {Some(name) => cformat!("Running {command_type} <bold>{name}</>"),@@ -200,7 +200,7 @@ mod tests {#[test]fn test_format_command_label() {use insta::assert_snapshot;- assert_snapshot!(format_command_label("post-create", Some("install")), @"Running post-create [1minstall[22m");+ assert_snapshot!(format_command_label("post-start", Some("install")), @"Running post-start [1minstall[22m");assert_snapshot!(format_command_label("pre-merge", None), @"Running pre-merge");assert_snapshot!(format_command_label("post-start", Some("build")), @"Running post-start [1mbuild[22m");assert_snapshot!(format_command_label("pre-commit", None), @"Running pre-commit");diff --git a/src/git/repository/working_tree.rs b/src/git/repository/working_tree.rsindex 613f74b14..d0032f670 100644--- a/src/git/repository/working_tree.rs+++ b/src/git/repository/working_tree.rs@@ -26,7 +26,8 @@ fn has_initialized_submodules_from_status(status: &str) -> bool {////// Mirrors what the batched `git rev-parse` actually resolved so callers can/// read the data directly instead of round-tripping through the per-field-/// cache accessors. `prewarm_info` still primes [`RepoCache`] so later calls+/// cache accessors. `prewarm_info` still primes the process-wide+/// `WORKTREE_ROOTS`, `GIT_DIRS`, and `CURRENT_BRANCHES` maps so later calls/// to [`WorkingTree::branch`], [`WorkingTree::root`], and/// [`WorkingTree::git_dir`] remain single cache hits. HEAD SHA is not cached:/// `wt merge` and similar commands move HEAD mid-run, and a stale cached SHA@@ -38,8 +39,6 @@ fn has_initialized_submodules_from_status(status: &str) -> bool {/// unless canonicalization failed. `current_branch` is only populated when/// the whole batch succeeded; on unborn HEAD it stays `None` and the/// per-accessor fallback paths handle the symbolic-ref lookup.-///-/// [`RepoCache`]: super::RepoCache#[derive(Debug, Clone, Default)]#[must_use]pub struct WorkingTreeGitInfo {