Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
refactor(config): make aliases fields non-optional (#2102)
Maximilian Roosf37d238aa842
diff --git a/src/config/user/accessors.rs b/src/config/user/accessors.rsindex 6b566f16c..95e105edb 100644--- a/src/config/user/accessors.rs+++ b/src/config/user/accessors.rs@@ -186,12 +186,9 @@ impl UserConfig {/// Merges global user aliases with per-project user aliases using append/// semantics: both run on name collision (global first, then per-project).pub fn aliases(&self, project: Option<&str>) -> BTreeMap<String, CommandConfig> {- let mut result = self.aliases.clone().unwrap_or_default();- if let Some(proj_aliases) = project- .and_then(|p| self.projects.get(p))- .and_then(|proj| proj.aliases.as_ref())- {- crate::config::commands::append_aliases(&mut result, proj_aliases);+ let mut result = self.aliases.clone();+ if let Some(proj) = self.project_overrides(project) {+ crate::config::commands::append_aliases(&mut result, &proj.aliases);}result}diff --git a/src/config/user/mod.rs b/src/config/user/mod.rsindex 04ca5b99b..5fc647203 100644--- a/src/config/user/mod.rs+++ b/src/config/user/mod.rs@@ -289,8 +289,8 @@ pub struct UserConfig {pub step: Option<sections::StepConfig>,/// Command aliases for `wt step <name>`- #[serde(default, skip_serializing_if = "Option::is_none")]- pub aliases: Option<std::collections::BTreeMap<String, crate::config::commands::CommandConfig>>,+ #[serde(default, skip_serializing_if = "std::collections::BTreeMap::is_empty")]+ pub aliases: std::collections::BTreeMap<String, crate::config::commands::CommandConfig>,/// Skip the first-run shell integration prompt#[serde(diff --git a/src/config/user/sections.rs b/src/config/user/sections.rsindex 6b5ac06aa..1419b6c25 100644--- a/src/config/user/sections.rs+++ b/src/config/user/sections.rs@@ -517,6 +517,6 @@ pub struct UserProjectOverrides {#[serde(default, skip_serializing_if = "Option::is_none")]pub step: Option<StepConfig>,- #[serde(default, skip_serializing_if = "Option::is_none")]- pub aliases: Option<BTreeMap<String, CommandConfig>>,+ #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]+ pub aliases: BTreeMap<String, CommandConfig>,}