Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

feat: add system-wide config file support (#963)

Gary Reynolds670d6cc7d2c6
diff --git a/docs/content/config.md b/docs/content/config.md
index dfe1ce39a..881b01840 100644
--- a/docs/content/config.md
+++ b/docs/content/config.md
@@ -43,6 +43,8 @@ wt config show
| **User config** | `~/.config/worktrunk/config.toml` | Worktree path template, LLM commit configs, etc | ✗ |
| **Project config** | `.config/wt.toml` | Project hooks, dev server URL | ✓ |
+Organizations can also deploy a system-wide config file for shared defaults — run `wt config show` for the platform-specific location.
+
**User config** — personal preferences:
```toml
@@ -353,6 +355,8 @@ WORKTRUNK_COMMIT__GENERATION__COMMAND="echo 'test: automated commit'" wt merge
|----------|---------|
| `WORKTRUNK_BIN` | Override binary path for shell wrappers (useful for testing dev builds) |
| `WORKTRUNK_CONFIG_PATH` | Override user config file location |
+| `WORKTRUNK_SYSTEM_CONFIG_PATH` | Override system config file location |
+| `XDG_CONFIG_DIRS` | Colon-separated system config directories (default: `/etc/xdg`) |
| `WORKTRUNK_DIRECTIVE_FILE` | Internal: set by shell wrappers to enable directory changes |
| `WORKTRUNK_SHELL` | Internal: set by shell wrappers to indicate shell type (e.g., `powershell`) |
| `WORKTRUNK_MAX_CONCURRENT_COMMANDS` | Max parallel git commands (default: 32). Lower if hitting file descriptor limits. |
@@ -396,7 +400,7 @@ Usage: <b><span class=c>wt config</span></b> <span class=c>[OPTIONS]</span> <spa
Show configuration files & locations.
Shows location and contents of user config (`~/.config/worktrunk/config.toml`)
-and project config (`.config/wt.toml`).
+and project config (`.config/wt.toml`). Also shows system config if present.
If a config file doesn't exist, shows defaults that would be used.
diff --git a/skills/worktrunk/reference/config.md b/skills/worktrunk/reference/config.md
index f3a2666a3..a9b0799e7 100644
--- a/skills/worktrunk/reference/config.md
+++ b/skills/worktrunk/reference/config.md
@@ -35,6 +35,8 @@ wt config show
| **User config** | `~/.config/worktrunk/config.toml` | Worktree path template, LLM commit configs, etc | ✗ |
| **Project config** | `.config/wt.toml` | Project hooks, dev server URL | ✓ |
+Organizations can also deploy a system-wide config file for shared defaults — run `wt config show` for the platform-specific location.
+
**User config** — personal preferences:
```toml
@@ -345,6 +347,8 @@ WORKTRUNK_COMMIT__GENERATION__COMMAND="echo 'test: automated commit'" wt merge
|----------|---------|
| `WORKTRUNK_BIN` | Override binary path for shell wrappers (useful for testing dev builds) |
| `WORKTRUNK_CONFIG_PATH` | Override user config file location |
+| `WORKTRUNK_SYSTEM_CONFIG_PATH` | Override system config file location |
+| `XDG_CONFIG_DIRS` | Colon-separated system config directories (default: `/etc/xdg`) |
| `WORKTRUNK_DIRECTIVE_FILE` | Internal: set by shell wrappers to enable directory changes |
| `WORKTRUNK_SHELL` | Internal: set by shell wrappers to indicate shell type (e.g., `powershell`) |
| `WORKTRUNK_MAX_CONCURRENT_COMMANDS` | Max parallel git commands (default: 32). Lower if hitting file descriptor limits. |
@@ -386,7 +390,7 @@ Usage: <b><span class=c>wt config</span></b> <span class=c>[OPTIONS]</span> <spa
Show configuration files & locations.
Shows location and contents of user config (`~/.config/worktrunk/config.toml`)
-and project config (`.config/wt.toml`).
+and project config (`.config/wt.toml`). Also shows system config if present.
If a config file doesn't exist, shows defaults that would be used.
diff --git a/src/cli/config.rs b/src/cli/config.rs
index a75ad0540..cb76585d0 100644
--- a/src/cli/config.rs
+++ b/src/cli/config.rs
@@ -213,7 +213,7 @@ pub enum ConfigCommand {
/// Show configuration files & locations
#[command(
after_long_help = r#"Shows location and contents of user config (`~/.config/worktrunk/config.toml`)
-and project config (`.config/wt.toml`).
+and project config (`.config/wt.toml`). Also shows system config if present.
If a config file doesn't exist, shows defaults that would be used.
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 1e96019a7..15b39d75a 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -1487,6 +1487,8 @@ wt config show
| **User config** | `~/.config/worktrunk/config.toml` | Worktree path template, LLM commit configs, etc | ✗ |
| **Project config** | `.config/wt.toml` | Project hooks, dev server URL | ✓ |
+Organizations can also deploy a system-wide config file for shared defaults — run `wt config show` for the platform-specific location.
+
**User config** — personal preferences:
```toml
@@ -1797,6 +1799,8 @@ WORKTRUNK_COMMIT__GENERATION__COMMAND="echo 'test: automated commit'" wt merge
|----------|---------|
| `WORKTRUNK_BIN` | Override binary path for shell wrappers (useful for testing dev builds) |
| `WORKTRUNK_CONFIG_PATH` | Override user config file location |
+| `WORKTRUNK_SYSTEM_CONFIG_PATH` | Override system config file location |
+| `XDG_CONFIG_DIRS` | Colon-separated system config directories (default: `/etc/xdg`) |
| `WORKTRUNK_DIRECTIVE_FILE` | Internal: set by shell wrappers to enable directory changes |
| `WORKTRUNK_SHELL` | Internal: set by shell wrappers to indicate shell type (e.g., `powershell`) |
| `WORKTRUNK_MAX_CONCURRENT_COMMANDS` | Max parallel git commands (default: 32). Lower if hitting file descriptor limits. |
diff --git a/src/commands/config/show.rs b/src/commands/config/show.rs
index b58a13927..78975d83d 100644
--- a/src/commands/config/show.rs
+++ b/src/commands/config/show.rs
@@ -10,7 +10,8 @@ use std::path::PathBuf;
use anyhow::Context;
use color_print::cformat;
use worktrunk::config::{
- ProjectConfig, UserConfig, find_unknown_project_keys, find_unknown_user_keys,
+ ProjectConfig, UserConfig, default_system_config_path, find_unknown_project_keys,
+ find_unknown_user_keys, get_system_config_path,
};
use worktrunk::git::Repository;
use worktrunk::path::format_path_for_display;
@@ -34,8 +35,14 @@ pub fn handle_config_show(full: bool) -> anyhow::Result<()> {
// Build the complete output as a string
let mut show_output = String::new();
+ // Render system config section (only when a system config file exists)
+ let has_system_config = render_system_config(&mut show_output)?;
+ if has_system_config {
+ show_output.push('\n');
+ }
+
// Render user config
- render_user_config(&mut show_output)?;
+ render_user_config(&mut show_output, has_system_config)?;
show_output.push('\n');
// Render project config if in a git repository
@@ -340,7 +347,48 @@ fn render_diagnostics(out: &mut String) -> anyhow::Result<()> {
Ok(())
}
-fn render_user_config(out: &mut String) -> anyhow::Result<()> {
+/// Render the SYSTEM CONFIG section. Returns true if a system config file was found.
+fn render_system_config(out: &mut String) -> anyhow::Result<bool> {
+ let Some(system_path) = get_system_config_path() else {
+ return Ok(false);
+ };
+
+ writeln!(
+ out,
+ "{}",
+ format_heading(
+ "SYSTEM CONFIG",
+ Some(&format_path_for_display(&system_path))
+ )
+ )?;
+
+ // Read and display the file contents
+ let contents =
+ std::fs::read_to_string(&system_path).context("Failed to read system config file")?;
+
+ if contents.trim().is_empty() {
+ writeln!(out, "{}", hint_message("Empty file (no system defaults)"))?;
+ return Ok(true);
+ }
+
+ // Validate config (syntax + schema) and warn if invalid
+ if let Err(e) = toml::from_str::<UserConfig>(&contents) {
+ writeln!(out, "{}", error_message("Invalid config"))?;
+ writeln!(out, "{}", format_with_gutter(&e.to_string(), None))?;
+ } else {
+ // Only check for unknown keys if config is valid
+ out.push_str(&warn_unknown_keys::<UserConfig>(&find_unknown_user_keys(
+ &contents,
+ )));
+ }
+
+ // Display TOML with syntax highlighting
+ writeln!(out, "{}", format_toml(&contents))?;
+
+ Ok(true)
+}
+
+fn render_user_config(out: &mut String, has_system_config: bool) -> anyhow::Result<()> {
let config_path = require_user_config_path()?;
writeln!(
@@ -406,6 +454,24 @@ fn render_user_config(out: &mut String) -> anyhow::Result<()> {
// Display TOML with syntax highlighting (gutter at column 0)
writeln!(out, "{}", format_toml(&contents))?;
+ if !has_system_config {
+ render_system_config_hint(out)?;
+ }
+
+ Ok(())
+}
+
+fn render_system_config_hint(out: &mut String) -> anyhow::Result<()> {
+ if let Some(path) = default_system_config_path() {
+ writeln!(
+ out,
+ "{}",
+ hint_message(cformat!(
+ "Optional system config not found @ <dim>{}</>",
+ format_path_for_display(&path)
+ ))
+ )?;
+ }
Ok(())
}
diff --git a/src/config/mod.rs b/src/config/mod.rs
index d56803d07..9425eb070 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -1,17 +1,15 @@
//! Configuration system for worktrunk
//!
-//! Worktrunk uses two independent configuration files:
+//! Three configuration sources, loaded in order (later overrides earlier):
//!
-//! - **User config** (`~/.config/worktrunk/config.toml`) - Personal preferences
-//! - **Project config** (`.config/wt.toml`) - Lifecycle hooks, checked into git
+//! 1. **System config** (`/etc/xdg/worktrunk/config.toml` or platform equivalent) -
+//! Organization-wide defaults, optional
+//! 2. **User config** (`~/.config/worktrunk/config.toml`) - Personal preferences
+//! 3. **Project config** (`.config/wt.toml`) - Lifecycle hooks, checked into git
//!
-//! The two configs are **completely independent**:
-//! - No overlap in settings (they configure different things)
-//! - No merging or precedence rules needed
-//! - Loaded separately and used in different contexts
-//!
-//! User config controls "how worktrunk behaves for me", project config controls
-//! "what commands run for this project".
+//! System and user configs share the same schema and are merged by the `config`
+//! crate's builder (user values override system values at the key level).
+//! Project config is independent — different schema, different purpose.
//!
//! See `wt config --help` for complete documentation.
@@ -96,7 +94,8 @@ pub use project::{
pub use user::{
CommitConfig, CommitGenerationConfig, ListConfig, MergeConfig, OverridableConfig,
ResolvedConfig, SelectConfig, StageMode, UserConfig, UserProjectOverrides,
- find_unknown_keys as find_unknown_user_keys, get_config_path, set_config_path,
+ default_system_config_path, find_unknown_keys as find_unknown_user_keys, get_config_path,
+ get_system_config_path, set_config_path,
};
#[cfg(test)]
diff --git a/src/config/user/mod.rs b/src/config/user/mod.rs
index 382aaa54f..4d86e86e8 100644
--- a/src/config/user/mod.rs
+++ b/src/config/user/mod.rs
@@ -19,7 +19,9 @@ use serde::{Deserialize, Serialize};
// Re-export public types
pub use merge::Merge;
-pub use path::{get_config_path, set_config_path};
+pub use path::{
+ default_system_config_path, get_config_path, get_system_config_path, set_config_path,
+};
pub use resolved::ResolvedConfig;
pub use schema::{find_unknown_keys, valid_user_config_keys};
pub use sections::{
@@ -106,19 +108,39 @@ pub struct UserConfig {
}
impl UserConfig {
- /// Load configuration from config file and environment variables.
+ /// Load configuration from system config, user config, and environment variables.
///
/// Configuration is loaded in the following order (later sources override earlier ones):
/// 1. Default values
- /// 2. Config file (see struct documentation for platform-specific paths)
- /// 3. Environment variables (WORKTRUNK_*)
+ /// 2. System config (organization-wide defaults)
+ /// 3. User config file (personal preferences)
+ /// 4. Environment variables (WORKTRUNK_*)
pub fn load() -> Result<Self, ConfigError> {
// Note: worktree-path has no default set here - it's handled by the getter
// which returns the default when None. This allows us to distinguish
// "user explicitly set this" from "using default".
let mut builder = Config::builder();
- // Add config file if it exists
+ // Add system config if it exists (lowest priority file source)
+ if let Some(system_path) = path::get_system_config_path() {
+ if let Ok(content) = std::fs::read_to_string(&system_path) {
+ // Warn about unknown fields in system config
+ let unknown_keys: std::collections::HashMap<_, _> = find_unknown_keys(&content)
+ .into_iter()
+ .filter(|(k, _)| {
+ !super::deprecation::DEPRECATED_SECTION_KEYS.contains(&k.as_str())
+ })
+ .collect();
+ super::deprecation::warn_unknown_fields::<UserConfig>(
+ &system_path,
+ &unknown_keys,
+ "System config",
+ );
+ }
+ builder = builder.add_source(File::from(system_path));
+ }
+
+ // Add user config file if it exists (overrides system config)
let config_path = get_config_path();
if let Some(config_path) = config_path.as_ref()
&& config_path.exists()
diff --git a/src/config/user/path.rs b/src/config/user/path.rs
index f62bc01d5..c3e13ceaf 100644
--- a/src/config/user/path.rs
+++ b/src/config/user/path.rs
@@ -6,7 +6,6 @@
use std::path::PathBuf;
use std::sync::OnceLock;
-#[cfg(not(test))]
use etcetera::base_strategy::{BaseStrategy, choose_base_strategy};
/// Override for user config path, set via --config CLI flag
@@ -38,26 +37,114 @@ pub fn get_config_path() -> Option<PathBuf> {
return Some(path.clone());
}
- // Priority 2: Environment variable (also used by tests)
+ // Priority 2: Environment variable (also used by tests for isolation)
if let Ok(path) = std::env::var("WORKTRUNK_CONFIG_PATH") {
return Some(PathBuf::from(path));
}
- // In test builds, WORKTRUNK_CONFIG_PATH must be set to prevent polluting user config
- #[cfg(test)]
- panic!(
- "WORKTRUNK_CONFIG_PATH not set in test. Tests must use TestRepo which sets this automatically, \
- or set it manually to an isolated test config path."
- );
+ // Priority 3: Platform-specific default location
+ let strategy = choose_base_strategy().ok()?;
+ Some(strategy.config_dir().join("worktrunk").join("config.toml"))
+}
+
+/// Get the system-wide config file path, if one exists.
+///
+/// System config provides organization-wide defaults that user config overrides.
+/// Returns the first existing config file found in the system config directories.
+///
+/// Priority:
+/// 1. WORKTRUNK_SYSTEM_CONFIG_PATH environment variable (for testing/overrides)
+/// 2. Each directory in $XDG_CONFIG_DIRS (colon-separated, checked in order)
+/// 3. Platform-specific default:
+/// - Linux: /etc/xdg/worktrunk/config.toml (XDG default)
+/// - macOS: /Library/Application Support/worktrunk/config.toml
+/// - Windows: %PROGRAMDATA%\worktrunk\config.toml
+pub fn get_system_config_path() -> Option<PathBuf> {
+ // Priority 1: Explicit environment variable override
+ if let Ok(path) = std::env::var("WORKTRUNK_SYSTEM_CONFIG_PATH") {
+ let path = PathBuf::from(path);
+ if path.exists() {
+ return Some(path);
+ }
+ return None;
+ }
+
+ // Priority 2+3: Check XDG_CONFIG_DIRS (if set), otherwise platform defaults.
+ // When XDG_CONFIG_DIRS is set, system_config_dirs() returns only those dirs
+ // (per XDG spec, no fallback to platform defaults).
+ for dir in &system_config_dirs() {
+ let path = dir.join("worktrunk").join("config.toml");
+ if path.exists() {
+ return Some(path);
+ }
+ }
+
+ None
+}
+
+/// The expected system config path for the current platform.
+///
+/// Used by `wt config show` to display where to put a system config file.
+/// Mirrors the lookup order in `get_system_config_path()` so the displayed
+/// path matches where the tool actually looks.
+pub fn default_system_config_path() -> Option<PathBuf> {
+ if let Ok(path) = std::env::var("WORKTRUNK_SYSTEM_CONFIG_PATH") {
+ return Some(PathBuf::from(path));
+ }
- // Production: use standard config location
- // choose_base_strategy uses:
- // - XDG on Linux (respects XDG_CONFIG_HOME, falls back to ~/.config)
- // - XDG on macOS (~/.config instead of ~/Library/Application Support)
- // - Windows conventions on Windows (%APPDATA%)
- #[cfg(not(test))]
+ system_config_dirs()
+ .first()
+ .map(|dir| dir.join("worktrunk").join("config.toml"))
+}
+
+/// System config directories in priority order.
+///
+/// On Unix, checks `XDG_CONFIG_DIRS` first. When set, it defines the search
+/// path exclusively (per XDG spec) — no fallback to platform defaults.
+/// Otherwise, returns platform-specific defaults (macOS: `/Library/Application
+/// Support`, Windows: `%PROGRAMDATA%`, Unix: `/etc/xdg`).
+fn system_config_dirs() -> Vec<PathBuf> {
+ #[cfg(unix)]
+ if let Ok(dirs_str) = std::env::var("XDG_CONFIG_DIRS") {
+ let dirs: Vec<PathBuf> = dirs_str
+ .split(':')
+ .filter(|d| !d.is_empty())
+ .map(PathBuf::from)
+ .collect();
+ if !dirs.is_empty() {
+ return dirs;
+ }
+ }
+
+ platform_default_dirs()
+}
+
+/// Platform-specific default system config directories.
+///
+/// Returns directories in priority order — the first existing config file wins.
+/// On macOS, the native `/Library/Application Support/` is checked before the
+/// XDG fallback `/etc/xdg/`.
+#[allow(clippy::vec_init_then_push)]
+fn platform_default_dirs() -> Vec<PathBuf> {
+ let mut dirs = Vec::new();
+
+ #[cfg(target_os = "macos")]
{
- let strategy = choose_base_strategy().ok()?;
- Some(strategy.config_dir().join("worktrunk").join("config.toml"))
+ // macOS native system-wide config location (checked first)
+ dirs.push(PathBuf::from("/Library/Application Support"));
}
+
+ #[cfg(target_os = "windows")]
+ {
+ // Windows: %PROGRAMDATA% (typically C:\ProgramData)
+ if let Ok(program_data) = std::env::var("PROGRAMDATA") {
+ dirs.push(PathBuf::from(program_data));
+ }
+ }
+
+ // XDG default: /etc/xdg (standard on Linux, fallback on macOS/other Unix)
+ #[cfg(unix)]
+ dirs.push(PathBuf::from("/etc/xdg"));
+
+ dirs
}
diff --git a/src/config/user/tests.rs b/src/config/user/tests.rs
index 8f25b616b..fcfcf66e9 100644
--- a/src/config/user/tests.rs
+++ b/src/config/user/tests.rs
@@ -1890,6 +1890,127 @@ fn test_reload_projects_from_invalid_toml() {
);
}
+// =========================================================================
+// System config loading and merge tests
+// =========================================================================
+
+#[test]
+fn test_system_config_merged_with_user_config() {
+ // System config provides base defaults
+ let system_toml = r#"
+[merge]
+squash = false
+rebase = false
+
+[list]
+full = true
+"#;
+
+ // User config overrides some settings
+ let user_toml = r#"
+[merge]
+squash = true
+"#;
+
+ // Parse both configs separately
+ let system_config = UserConfig::load_from_str(system_toml).unwrap();
+ let user_config = UserConfig::load_from_str(user_toml).unwrap();
+
+ // Verify system config values
+ assert_eq!(
+ system_config.configs.merge.as_ref().unwrap().squash,
+ Some(false)
+ );
+ assert_eq!(
+ system_config.configs.merge.as_ref().unwrap().rebase,
+ Some(false)
+ );
+ assert_eq!(
+ system_config.configs.list.as_ref().unwrap().full,
+ Some(true)
+ );
+
+ // Verify user config values
+ assert_eq!(
+ user_config.configs.merge.as_ref().unwrap().squash,
+ Some(true)
+ );
+
+ // Simulate the merge that happens via the config crate's builder:
+ // When both system and user configs define [merge], the config crate
+ // performs a deep merge where user values override system values.
+ // This is tested end-to-end via integration tests; here we verify
+ // the Merge trait works correctly for the layering.
+ let system_merge = system_config.configs.merge.as_ref().unwrap();
+ let user_merge = user_config.configs.merge.as_ref().unwrap();
+ let merged = system_merge.merge_with(user_merge);
+
+ assert_eq!(merged.squash, Some(true)); // User overrides
+ assert_eq!(merged.rebase, Some(false)); // System default preserved
+}
+
+#[test]
+fn test_system_config_worktree_path_overridden_by_user() {
+ let system_toml = r#"worktree-path = "/company/worktrees/{{ repo }}/{{ branch | sanitize }}""#;
+ let user_toml = r#"worktree-path = "../{{ repo }}.{{ branch | sanitize }}""#;
+
+ let system_config = UserConfig::load_from_str(system_toml).unwrap();
+ let user_config = UserConfig::load_from_str(user_toml).unwrap();
+
+ assert_eq!(
+ system_config.worktree_path(),
+ "/company/worktrees/{{ repo }}/{{ branch | sanitize }}"
+ );
+ assert_eq!(
+ user_config.worktree_path(),
+ "../{{ repo }}.{{ branch | sanitize }}"
+ );
+}
+
+#[test]
+fn test_system_config_commit_generation_merged() {
+ let system_toml = r#"
+[commit.generation]
+command = "company-llm-tool"
+template = "Company standard template: {{ git_diff }}"
+"#;
+ let user_toml = r#"
+[commit.generation]
+command = "my-preferred-llm"
+"#;
+
+ let system_config = UserConfig::load_from_str(system_toml).unwrap();
+ let user_config = UserConfig::load_from_str(user_toml).unwrap();
+
+ let system_gen = system_config.commit_generation(None);
+ assert_eq!(system_gen.command, Some("company-llm-tool".to_string()));
+ assert_eq!(
+ system_gen.template,
+ Some("Company standard template: {{ git_diff }}".to_string())
+ );
+
+ let user_gen = user_config.commit_generation(None);
+ assert_eq!(user_gen.command, Some("my-preferred-llm".to_string()));
+ // User didn't set template, so in a merged scenario the system template
+ // would be preserved via the config crate's deep merge
+}
+
+#[test]
+fn test_hooks_merge_trait_appends_for_global_project_merge() {
+ // The Merge trait uses append semantics — used for global→per-project merging
+ // (in accessors.rs). NOT used for system→user config merging, which goes
+ // through the config crate's replacement semantics instead.
+ let global_hooks = parse_hooks("pre-merge = \"global-lint\"");
+ let project_hooks = parse_hooks("pre-merge = \"project-lint\"");
+
+ let merged = global_hooks.merge_with(&project_hooks);
+ let pre_merge = merged.pre_merge.unwrap();
+ let commands = pre_merge.commands();
+ assert_eq!(commands.len(), 2);
+ assert_eq!(commands[0].template, "global-lint"); // Global first
+ assert_eq!(commands[1].template, "project-lint"); // Project second
+}
+
/// Test that reload_projects_from handles permission errors
/// when the config file exists but cannot be read.
#[cfg(unix)]
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index cf6e1a3f4..fc4b4cd33 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -687,6 +687,10 @@ pub fn configure_cli_command(cmd: &mut Command) {
// Note: env_remove above may cause insta-cmd to capture empty values in snapshots,
// but correctness (isolating from host WORKTRUNK_* vars) trumps snapshot aesthetics.
cmd.env("WORKTRUNK_CONFIG_PATH", "/nonexistent/test/config.toml");
+ cmd.env(
+ "WORKTRUNK_SYSTEM_CONFIG_PATH",
+ "/etc/xdg/worktrunk/config.toml",
+ );
cmd.env(
"WORKTRUNK_APPROVALS_PATH",
"/nonexistent/test/approvals.toml",
@@ -1180,6 +1184,10 @@ impl TestRepo {
"WORKTRUNK_CONFIG_PATH".to_string(),
self.test_config_path().display().to_string(),
),
+ (
+ "WORKTRUNK_SYSTEM_CONFIG_PATH".to_string(),
+ "/etc/xdg/worktrunk/config.toml".to_string(),
+ ),
(
"WORKTRUNK_APPROVALS_PATH".to_string(),
self.test_approvals_path().display().to_string(),
@@ -1321,6 +1329,10 @@ impl TestRepo {
configure_cli_command(cmd);
self.configure_git_cmd(cmd);
cmd.env("WORKTRUNK_CONFIG_PATH", &self.test_config_path);
+ cmd.env(
+ "WORKTRUNK_SYSTEM_CONFIG_PATH",
+ "/etc/xdg/worktrunk/config.toml",
+ );
cmd.env("WORKTRUNK_APPROVALS_PATH", &self.test_approvals_path);
set_temp_home_env(cmd, self.home_path());
self.configure_mock_commands(cmd);
@@ -2251,6 +2263,10 @@ impl BareRepoTest {
pub fn configure_wt_cmd(&self, cmd: &mut Command) {
self.configure_git_cmd(cmd);
cmd.env("WORKTRUNK_CONFIG_PATH", &self.test_config_path)
+ .env(
+ "WORKTRUNK_SYSTEM_CONFIG_PATH",
+ "/etc/xdg/worktrunk/config.toml",
+ )
.env("WORKTRUNK_APPROVALS_PATH", &self.test_approvals_path)
.env_remove("NO_COLOR")
.env_remove("CLICOLOR_FORCE");
@@ -2277,6 +2293,7 @@ impl TestRepoBase for BareRepoTest {
pub fn add_standard_env_redactions(settings: &mut insta::Settings) {
settings.add_redaction(".env.GIT_CONFIG_GLOBAL", "[TEST_GIT_CONFIG]");
settings.add_redaction(".env.WORKTRUNK_CONFIG_PATH", "[TEST_CONFIG]");
+ settings.add_redaction(".env.WORKTRUNK_SYSTEM_CONFIG_PATH", "[TEST_SYSTEM_CONFIG]");
settings.add_redaction(".env.WORKTRUNK_APPROVALS_PATH", "[TEST_APPROVALS]");
settings.add_redaction(".env.WORKTRUNK_DIRECTIVE_FILE", "[DIRECTIVE_FILE]");
settings.add_redaction(".env.HOME", "[TEST_HOME]");
@@ -2648,6 +2665,11 @@ fn setup_snapshot_settings_for_paths_with_home(
r"/private/var/folders/[^/]+/[^/]+/T/\.[^/]+/[^)'\s\x1b]+",
"[PROJECT_ID]",
);
+ // macOS non-canonicalized: /var/folders/.../T/.tmpXXXXXX/path -> [PROJECT_ID]
+ settings.add_filter(
+ r"/var/folders/[^/]+/[^/]+/T/\.[^/]+/[^)'\s\x1b]+",
+ "[PROJECT_ID]",
+ );
// Linux: /tmp/.tmpXXXXXX/path -> [PROJECT_ID]
settings.add_filter(r"/tmp/\.tmp[^/]+/[^)'\s\x1b]+", "[PROJECT_ID]");
// Windows: C:/Users/user/AppData/Local/Temp/.tmpXXXXXX/path -> [PROJECT_ID]
diff --git a/tests/integration_tests/config_show.rs b/tests/integration_tests/config_show.rs
index 3eec97c5b..6c75fa920 100644
--- a/tests/integration_tests/config_show.rs
+++ b/tests/integration_tests/config_show.rs
@@ -81,6 +81,477 @@ fn test_config_show_no_project_config(mut repo: TestRepo, temp_home: TempDir) {
});
}
+// ==================== System Config Tests ====================
+
+#[rstest]
+fn test_config_show_with_system_config(mut repo: TestRepo, temp_home: TempDir) {
+ repo.setup_mock_ci_tools_unauthenticated();
+
+ // Create system config in a temp directory
+ let system_config_dir = tempfile::tempdir().unwrap();
+ let system_config_path = system_config_dir.path().join("config.toml");
+ fs::write(
+ &system_config_path,
+ r#"[merge]
+squash = true
+verify = true
+
+[commit.generation]
+command = "company-llm-tool"
+"#,
+ )
+ .unwrap();
+
+ // Create user config
+ let global_config_dir = temp_home.path().join(".config").join("worktrunk");
+ fs::create_dir_all(&global_config_dir).unwrap();
+ fs::write(
+ global_config_dir.join("config.toml"),
+ r#"worktree-path = "../{{ repo }}.{{ branch }}"
+"#,
+ )
+ .unwrap();
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ repo.configure_mock_commands(&mut cmd);
+ cmd.env("WORKTRUNK_SYSTEM_CONFIG_PATH", &system_config_path);
+ cmd.arg("config").arg("show").current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
+#[rstest]
+fn test_system_config_values_used_as_defaults(repo: TestRepo) {
+ // System config with a distinctive worktree-path template
+ let system_config_dir = tempfile::tempdir().unwrap();
+ let system_config_path = system_config_dir.path().join("config.toml");
+ fs::write(
+ &system_config_path,
+ "worktree-path = \".worktrees/{{ branch | sanitize }}\"\n",
+ )
+ .unwrap();
+
+ // No user config — system config should provide the worktree-path default
+ let mut cmd = repo.wt_command();
+ cmd.env("WORKTRUNK_SYSTEM_CONFIG_PATH", &system_config_path);
+ cmd.args(["switch", "--create", "test-feature"])
+ .current_dir(repo.root_path());
+
+ let output = cmd.output().unwrap();
+ assert!(
+ output.status.success(),
+ "switch --create should succeed: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+
+ // Worktree should be at the system config template path
+ let expected_path = repo.root_path().join(".worktrees").join("test-feature");
+ assert!(
+ expected_path.exists(),
+ "Worktree should be created at system config template path: {}",
+ expected_path.display()
+ );
+}
+
+#[rstest]
+fn test_user_config_overrides_system_config(repo: TestRepo) {
+ // System config with one template
+ let system_config_dir = tempfile::tempdir().unwrap();
+ let system_config_path = system_config_dir.path().join("config.toml");
+ fs::write(
+ &system_config_path,
+ "worktree-path = \".worktrees/system/{{ branch | sanitize }}\"\n",
+ )
+ .unwrap();
+
+ // User config overrides with a different template
+ let user_config_dir = tempfile::tempdir().unwrap();
+ let user_config_path = user_config_dir.path().join("config.toml");
+ fs::write(
+ &user_config_path,
+ "worktree-path = \".worktrees/user/{{ branch | sanitize }}\"\n",
+ )
+ .unwrap();
+
+ let mut cmd = repo.wt_command();
+ cmd.env("WORKTRUNK_SYSTEM_CONFIG_PATH", &system_config_path);
+ cmd.env("WORKTRUNK_CONFIG_PATH", &user_config_path);
+ cmd.args(["switch", "--create", "test-feature"])
+ .current_dir(repo.root_path());
+
+ let output = cmd.output().unwrap();
+ assert!(
+ output.status.success(),
+ "switch --create should succeed: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+
+ // Should use user config template, not system
+ let user_path = repo.root_path().join(".worktrees/user/test-feature");
+ let system_path = repo.root_path().join(".worktrees/system/test-feature");
+ assert!(
+ user_path.exists(),
+ "Worktree should be at user config template path: {}",
+ user_path.display()
+ );
+ assert!(
+ !system_path.exists(),
+ "Worktree should NOT be at system config template path"
+ );
+}
+
+/// System and user config hooks are deep-merged by the config crate at the TOML
+/// key level. Differently-named commands within the same hook type coexist —
+/// system hooks and user hooks both run. Same-named commands: user replaces system.
+#[rstest]
+fn test_system_and_user_hooks_deep_merged(repo: TestRepo) {
+ // System config defines a named pre-merge hook
+ let system_config_dir = tempfile::tempdir().unwrap();
+ let system_config_path = system_config_dir.path().join("config.toml");
+ fs::write(
+ &system_config_path,
+ r#"[pre-merge]
+company-lint = "company-lint-tool"
+"#,
+ )
+ .unwrap();
+
+ // User config defines a differently-named pre-merge hook
+ let user_config_dir = tempfile::tempdir().unwrap();
+ let user_config_path = user_config_dir.path().join("config.toml");
+ fs::write(
+ &user_config_path,
+ r#"[pre-merge]
+my-lint = "my-lint-tool"
+"#,
+ )
+ .unwrap();
+
+ let mut cmd = repo.wt_command();
+ cmd.env("WORKTRUNK_SYSTEM_CONFIG_PATH", &system_config_path);
+ cmd.env("WORKTRUNK_CONFIG_PATH", &user_config_path);
+ cmd.args(["hook", "show", "pre-merge"])
+ .current_dir(repo.root_path());
+
+ let output = cmd.output().unwrap();
+ assert!(
+ output.status.success(),
+ "hook show should succeed: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+
+ let stderr = String::from_utf8_lossy(&output.stderr);
+
+ // Both hooks should be present (deep merge preserves differently-named keys)
+ assert!(
+ stderr.contains("company-lint-tool"),
+ "System hook should be preserved with different name, got:\n{stderr}"
+ );
+ assert!(
+ stderr.contains("my-lint-tool"),
+ "User hook should be present, got:\n{stderr}"
+ );
+}
+
+/// When user config defines a hook with the same name as system config,
+/// the user's command replaces the system's command for that name.
+#[rstest]
+fn test_user_hook_replaces_same_named_system_hook(repo: TestRepo) {
+ // System config defines a named hook
+ let system_config_dir = tempfile::tempdir().unwrap();
+ let system_config_path = system_config_dir.path().join("config.toml");
+ fs::write(
+ &system_config_path,
+ r#"[pre-merge]
+lint = "company-lint-tool"
+"#,
+ )
+ .unwrap();
+
+ // User config defines the same-named hook with different command
+ let user_config_dir = tempfile::tempdir().unwrap();
+ let user_config_path = user_config_dir.path().join("config.toml");
+ fs::write(
+ &user_config_path,
+ r#"[pre-merge]
+lint = "my-lint-tool"
+"#,
+ )
+ .unwrap();
+
+ let mut cmd = repo.wt_command();
+ cmd.env("WORKTRUNK_SYSTEM_CONFIG_PATH", &system_config_path);
+ cmd.env("WORKTRUNK_CONFIG_PATH", &user_config_path);
+ cmd.args(["hook", "show", "pre-merge"])
+ .current_dir(repo.root_path());
+
+ let output = cmd.output().unwrap();
+ assert!(
+ output.status.success(),
+ "hook show should succeed: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+
+ let stderr = String::from_utf8_lossy(&output.stderr);
+
+ // User's command should replace system's for the same name
+ assert!(
+ stderr.contains("my-lint-tool"),
+ "User's hook command should be present, got:\n{stderr}"
+ );
+ assert!(
+ !stderr.contains("company-lint-tool"),
+ "System's hook command should be replaced by user's same-named hook, got:\n{stderr}"
+ );
+}
+
+/// When user config doesn't define a hook type, the system config's hook is preserved.
+#[rstest]
+fn test_system_config_hooks_preserved_when_user_doesnt_override(repo: TestRepo) {
+ // System config defines pre-merge and pre-commit hooks
+ let system_config_dir = tempfile::tempdir().unwrap();
+ let system_config_path = system_config_dir.path().join("config.toml");
+ fs::write(
+ &system_config_path,
+ r#"[pre-merge]
+company-lint = "company-lint-tool"
+
+[pre-commit]
+company-format = "company-format-tool"
+"#,
+ )
+ .unwrap();
+
+ // User config only defines pre-merge (should leave system's pre-commit intact)
+ let user_config_dir = tempfile::tempdir().unwrap();
+ let user_config_path = user_config_dir.path().join("config.toml");
+ fs::write(
+ &user_config_path,
+ r#"[pre-merge]
+my-lint = "my-lint-tool"
+"#,
+ )
+ .unwrap();
+
+ // Check pre-commit — should still have system's hook
+ let mut cmd = repo.wt_command();
+ cmd.env("WORKTRUNK_SYSTEM_CONFIG_PATH", &system_config_path);
+ cmd.env("WORKTRUNK_CONFIG_PATH", &user_config_path);
+ cmd.args(["hook", "show", "pre-commit"])
+ .current_dir(repo.root_path());
+
+ let output = cmd.output().unwrap();
+ assert!(
+ output.status.success(),
+ "hook show should succeed: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ assert!(
+ stderr.contains("company-format-tool"),
+ "System's pre-commit hook should be preserved when user doesn't override it, got:\n{stderr}"
+ );
+}
+
+#[rstest]
+fn test_config_show_system_config_hint_under_user_config(repo: TestRepo, temp_home: TempDir) {
+ // When no system config exists but user config does, config show should
+ // display a hint under USER CONFIG with the platform-specific default path
+ let global_config_dir = temp_home.path().join(".config").join("worktrunk");
+ fs::create_dir_all(&global_config_dir).unwrap();
+ fs::write(
+ global_config_dir.join("config.toml"),
+ "worktree-path = \"../{{ repo }}.{{ branch }}\"\n",
+ )
+ .unwrap();
+
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ set_temp_home_env(&mut cmd, temp_home.path());
+ cmd.env_remove("WORKTRUNK_SYSTEM_CONFIG_PATH");
+ cmd.arg("config").arg("show").current_dir(repo.root_path());
+
+ let output = cmd.output().unwrap();
+ let stderr = String::from_utf8_lossy(&output.stderr);
+
+ // Should NOT show a full SYSTEM CONFIG heading
+ assert!(
+ !stderr.contains("SYSTEM CONFIG"),
+ "Should not show SYSTEM CONFIG section when absent, got:\n{stderr}"
+ );
+ // Should show a system config hint under USER CONFIG
+ assert!(
+ stderr.contains("Optional system config not found")
+ && stderr.contains("worktrunk/config.toml"),
+ "Expected system config hint in output, got:\n{stderr}"
+ );
+}
+
+#[rstest]
+fn test_system_config_found_via_xdg_config_dirs(repo: TestRepo) {
+ // Create system config in a custom XDG directory
+ let xdg_dir = tempfile::tempdir().unwrap();
+ let config_dir = xdg_dir.path().join("worktrunk");
+ fs::create_dir_all(&config_dir).unwrap();
+ fs::write(
+ config_dir.join("config.toml"),
+ r#"worktree-path = "/xdg-org/{{ repo }}/{{ branch | sanitize }}"
+"#,
+ )
+ .unwrap();
+
+ // Use XDG_CONFIG_DIRS instead of WORKTRUNK_SYSTEM_CONFIG_PATH
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ cmd.env_remove("WORKTRUNK_SYSTEM_CONFIG_PATH");
+ cmd.env("XDG_CONFIG_DIRS", xdg_dir.path());
+ cmd.arg("list")
+ .arg("--format=json")
+ .current_dir(repo.root_path());
+
+ let output = cmd.output().unwrap();
+ assert!(output.status.success());
+
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ let json: serde_json::Value = serde_json::from_str(&stdout).unwrap();
+ let worktrees = json.as_array().unwrap();
+
+ for wt in worktrees {
+ if wt["is_primary"].as_bool() == Some(false) {
+ let path = wt["path"].as_str().unwrap();
+ assert!(
+ path.contains("/xdg-org/"),
+ "Expected XDG_CONFIG_DIRS system config, got: {path}"
+ );
+ }
+ }
+}
+
+#[rstest]
+fn test_system_config_xdg_dirs_set_but_no_config_found(repo: TestRepo) {
+ // When XDG_CONFIG_DIRS is set but contains no worktrunk config,
+ // system config should be None (no fallback to platform defaults)
+ let empty_xdg_dir = tempfile::tempdir().unwrap();
+
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ cmd.env_remove("WORKTRUNK_SYSTEM_CONFIG_PATH");
+ cmd.env("XDG_CONFIG_DIRS", empty_xdg_dir.path());
+ cmd.arg("list")
+ .arg("--format=json")
+ .current_dir(repo.root_path());
+
+ let output = cmd.output().unwrap();
+ assert!(output.status.success());
+
+ // Without system config, worktree paths should use the default template
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ let json: serde_json::Value = serde_json::from_str(&stdout).unwrap();
+ let worktrees = json.as_array().unwrap();
+
+ for wt in worktrees {
+ if wt["is_primary"].as_bool() == Some(false) {
+ let path = wt["path"].as_str().unwrap();
+ assert!(
+ !path.contains("/xdg-org/"),
+ "Should not use XDG system config path, got: {path}"
+ );
+ }
+ }
+}
+
+/// Test that `config show` displays empty system config with a hint
+#[rstest]
+fn test_config_show_empty_system_config(mut repo: TestRepo, temp_home: TempDir) {
+ repo.setup_mock_ci_tools_unauthenticated();
+
+ // Create empty system config
+ let system_config_dir = tempfile::tempdir().unwrap();
+ let system_config_path = system_config_dir.path().join("config.toml");
+ fs::write(&system_config_path, "").unwrap();
+
+ // Create user config
+ let global_config_dir = temp_home.path().join(".config").join("worktrunk");
+ fs::create_dir_all(&global_config_dir).unwrap();
+ fs::write(global_config_dir.join("config.toml"), "").unwrap();
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ repo.configure_mock_commands(&mut cmd);
+ cmd.env("WORKTRUNK_SYSTEM_CONFIG_PATH", &system_config_path);
+ cmd.arg("config").arg("show").current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
+/// Test that `config show` displays invalid system config with error details
+#[rstest]
+fn test_config_show_invalid_system_config(mut repo: TestRepo, temp_home: TempDir) {
+ repo.setup_mock_ci_tools_unauthenticated();
+
+ // Create system config with invalid TOML
+ let system_config_dir = tempfile::tempdir().unwrap();
+ let system_config_path = system_config_dir.path().join("config.toml");
+ fs::write(&system_config_path, "invalid = [toml\n").unwrap();
+
+ // Create user config
+ let global_config_dir = temp_home.path().join(".config").join("worktrunk");
+ fs::create_dir_all(&global_config_dir).unwrap();
+ fs::write(global_config_dir.join("config.toml"), "").unwrap();
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ repo.configure_mock_commands(&mut cmd);
+ cmd.env("WORKTRUNK_SYSTEM_CONFIG_PATH", &system_config_path);
+ cmd.arg("config").arg("show").current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
+/// Test that system config with unknown keys triggers a warning during config loading
+#[rstest]
+fn test_system_config_unknown_keys_warning_during_load(repo: TestRepo) {
+ // Create system config with an unknown key
+ let system_config_dir = tempfile::tempdir().unwrap();
+ let system_config_path = system_config_dir.path().join("config.toml");
+ fs::write(
+ &system_config_path,
+ "[totally-unknown-section]\nkey = \"value\"",
+ )
+ .unwrap();
+
+ // Run `wt list` which triggers config loading and unknown key warnings
+ let mut cmd = repo.wt_command();
+ cmd.env("WORKTRUNK_SYSTEM_CONFIG_PATH", &system_config_path);
+ cmd.arg("list").current_dir(repo.root_path());
+
+ let output = cmd.output().unwrap();
+ assert!(
+ output.status.success(),
+ "Command should succeed: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ assert!(
+ stderr.contains("has unknown field"),
+ "Expected unknown field warning from system config load, got: {stderr}"
+ );
+}
+
#[rstest]
fn test_config_show_outside_git_repo(mut repo: TestRepo, temp_home: TempDir) {
let temp_dir = tempfile::tempdir().unwrap();
diff --git a/tests/integration_tests/shell_wrapper.rs b/tests/integration_tests/shell_wrapper.rs
index c88b170cb..00328a8d5 100644
--- a/tests/integration_tests/shell_wrapper.rs
+++ b/tests/integration_tests/shell_wrapper.rs
@@ -1128,6 +1128,9 @@ test = "echo '✓ All 47 tests passed in 2.3s'"
repo.commit("Add pre-merge validation");
let feature_wt = repo.add_feature();
+ // Suppress commit generation prompt (fires in PTY when claude is on PATH)
+ repo.write_test_config("");
+
// Pre-approve commands
repo.write_test_approvals(
r#"[projects."../origin"]
@@ -1176,6 +1179,9 @@ test = "echo '✗ Test suite failed: 3 tests failing' && exit 1"
repo.commit("Add failing pre-merge validation");
+ // Suppress commit generation prompt (fires in PTY when claude is on PATH)
+ repo.write_test_config("");
+
// Create feature worktree with a commit
let feature_wt = repo.add_worktree_with_commit(
"feature-fail",
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap
index eee635299..b71008882 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_claude_available_plugin_not_installed.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_claude_available_plugin_not_installed.snap
index a9121bd7d..99ea7b6b4 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_claude_available_plugin_not_installed.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_claude_available_plugin_not_installed.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "1"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -40,6 +43,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap
index 2c82c95ac..a80eaf3db 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -55,6 +58,7 @@ exit_code: 0
○ Current config:
  worktree-path = "../{{ main_worktree }}.{{ branch }}"
  post-create = "ln -sf {{ repo_root }}/node_modules"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_project_commit_generation_deprecations.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_project_commit_generation_deprecations.snap
index d158a3d70..82f712400 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_project_commit_generation_deprecations.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_project_commit_generation_deprecations.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -58,6 +61,7 @@ exit_code: 0
 
  [projects."github.com/example/repo".commit-generation]
  command = "llm -m gpt-4"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_empty_project_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_empty_project_config.snap
index 633da6c4a..55dfe674d 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_empty_project_config.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_empty_project_config.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -40,6 +43,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Empty file
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_empty_system_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_empty_system_config.snap
new file mode 100644
index 000000000..53a38364c
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_empty_system_config.snap
@@ -0,0 +1,68 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - show
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+SYSTEM CONFIG [PROJECT_ID]
+↳ Empty file (no system defaults)
+
+USER CONFIG ~/.config/worktrunk/config.toml
+↳ Empty file (using defaults)
+
+PROJECT CONFIG _REPO_/.config/wt.toml
+↳ Not found
+
+SHELL INTEGRATION
+▲ Shell integration not active
+  Invoked as: [PROJECT_ROOT]/target/debug/wt
+
+○ bash: Skipped; ~/.bashrc not found
+○ zsh: Skipped; ~/.zshrc not found
+○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
+
+CLAUDE CODE
+○ claude CLI not installed
+
+OTHER
+○ wt: [VERSION]
+○ git: [VERSION]
+○ Hyperlinks: inactive
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_fish_outdated_wrapper.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_fish_outdated_wrapper.snap
index 7be9a6d06..3d05819ff 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_fish_outdated_wrapper.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_fish_outdated_wrapper.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_fish_with_completions.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_fish_with_completions.snap
index 9443dca04..fdec77e09 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_fish_with_completions.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_fish_with_completions.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_fish_without_completions.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_fish_without_completions.snap
index bc7c4176a..ee968190d 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_fish_without_completions.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_fish_without_completions.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap
index cb30a22cb..9c4870f36 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap
index 4accd8b4a..50dda6d33 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap
@@ -26,11 +26,14 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
- WORKTRUNK_TEST_LATEST_VERSION: 0.23.3
+ WORKTRUNK_TEST_LATEST_VERSION: 0.24.1
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -45,6 +48,7 @@ exit_code: 0
 
  [commit.generation]
  command = "nonexistent-llm-command-12345 -m test-model"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap
index 6de5b5466..4f2bd1e37 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap
@@ -26,11 +26,14 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
- WORKTRUNK_TEST_LATEST_VERSION: 0.23.3
+ WORKTRUNK_TEST_LATEST_VERSION: 0.24.1
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -42,6 +45,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_full_update_available.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_full_update_available.snap
index 9d403a885..4e3e9f145 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_full_update_available.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_full_update_available.snap
@@ -26,11 +26,14 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
WORKTRUNK_TEST_LATEST_VERSION: 99.0.0
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -42,6 +45,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_full_version_check_unavailable.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_full_version_check_unavailable.snap
index b3531921b..861cbedb1 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_full_version_check_unavailable.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_full_version_check_unavailable.snap
@@ -26,11 +26,14 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
WORKTRUNK_TEST_LATEST_VERSION: error
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -42,6 +45,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_github_remote.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_github_remote.snap
index 926a046db..6f93454ad 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_github_remote.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_github_remote.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -40,6 +43,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_gitlab_remote.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_gitlab_remote.snap
index 926a046db..6f93454ad 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_gitlab_remote.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_gitlab_remote.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -40,6 +43,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_project_toml.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_project_toml.snap
index 0ca295042..2fface884 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_project_toml.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_project_toml.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -40,6 +43,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
✗ Invalid config
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_system_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_system_config.snap
new file mode 100644
index 000000000..c8f7cefaa
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_system_config.snap
@@ -0,0 +1,74 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - show
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+SYSTEM CONFIG [PROJECT_ID]
+✗ Invalid config
+  TOML parse error at line 1, column 17
+  |
+  1 | invalid = [toml
+  | ^
+  unclosed array, expected `]`
+  invalid = [toml
+
+USER CONFIG ~/.config/worktrunk/config.toml
+↳ Empty file (using defaults)
+
+PROJECT CONFIG _REPO_/.config/wt.toml
+↳ Not found
+
+SHELL INTEGRATION
+▲ Shell integration not active
+  Invoked as: [PROJECT_ROOT]/target/debug/wt
+
+○ bash: Skipped; ~/.bashrc not found
+○ zsh: Skipped; ~/.zshrc not found
+○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
+
+CLAUDE CODE
+○ claude CLI not installed
+
+OTHER
+○ wt: [VERSION]
+○ git: [VERSION]
+○ Hyperlinks: inactive
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_user_toml.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_user_toml.snap
index f2843c58c..0cc9059b2 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_user_toml.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_user_toml.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -46,6 +49,7 @@ exit_code: 0
  | ^
  key with no value, expected `=`
  this is not valid toml {{{
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_no_project_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_no_project_config.snap
index 926a046db..6f93454ad 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_no_project_config.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_no_project_config.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -40,6 +43,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_no_user_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_no_user_config.snap
index 20663db61..28afda7f9 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_no_user_config.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_no_user_config.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_outside_git_repo.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_outside_git_repo.snap
index e6a618257..907b633de 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_outside_git_repo.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_outside_git_repo.snap
@@ -20,10 +20,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -35,6 +38,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG Not in a git repository
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_partial_shell_config_shows_hint.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_partial_shell_config_shows_hint.snap
index 9c4412126..8916089c7 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_partial_shell_config_shows_hint.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_partial_shell_config_shows_hint.snap
@@ -25,11 +25,14 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_COMPINIT_CONFIGURED: "1"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_plugin_installed.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_plugin_installed.snap
index 736f51032..c44b8a03b 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_plugin_installed.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_plugin_installed.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "1"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -40,6 +43,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_powershell_detected_via_psmodulepath.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_powershell_detected_via_psmodulepath.snap
index 1c1896c7f..86b59d6f2 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_powershell_detected_via_psmodulepath.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_powershell_detected_via_psmodulepath.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "1"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_shell_integration_active.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_shell_integration_active.snap
index 549df3aaf..1121434f1 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_shell_integration_active.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_shell_integration_active.snap
@@ -25,11 +25,14 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
WORKTRUNK_DIRECTIVE_FILE: "[DIRECTIVE_FILE]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -41,6 +44,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_statusline_configured.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_statusline_configured.snap
index bec05ca54..f55d2ca53 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_statusline_configured.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_statusline_configured.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "1"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -40,6 +43,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_project_config_for_ci.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_project_config_for_ci.snap
index b13d9c8a3..f2e6a6662 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_project_config_for_ci.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_project_config_for_ci.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -44,6 +47,7 @@ exit_code: 0
 
  [ci]
  platform = "github"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_user_config_for_commit_generation.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_user_config_for_commit_generation.snap
index f5344eb4c..18fa6cb5a 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_user_config_for_commit_generation.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_user_config_for_commit_generation.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -40,6 +43,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
▲ Project config uses deprecated config sections: [commit-generation] → [commit.generation]
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_unmatched_candidate_warning.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_unmatched_candidate_warning.snap
index 3620ddb4e..0ceb0a255 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_unmatched_candidate_warning.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_unmatched_candidate_warning.snap
@@ -25,11 +25,14 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_COMPINIT_CONFIGURED: "1"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_project_keys.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_project_keys.snap
index a0df0fb65..31e704e45 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_project_keys.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_project_keys.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -40,6 +43,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
▲ Unknown key post-merge-command will be ignored
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_user_keys.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_user_keys.snap
index 7a973ec63..677267d6a 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_user_keys.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_user_keys.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -44,6 +47,7 @@ exit_code: 0
 
  [commit-gen]
  command = "llm"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Not found
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap
index 633da6c4a..55dfe674d 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap
@@ -25,10 +25,13 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -40,6 +43,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
↳ Empty file
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap
index a162e8e59..5ffcc04fb 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap
@@ -27,6 +27,7 @@ info:
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
@@ -42,6 +43,7 @@ exit_code: 0
----- stderr -----
USER CONFIG ~/.config/worktrunk/config.toml
  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
PROJECT CONFIG _REPO_/.config/wt.toml
  post-create = "npm install"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_with_system_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_with_system_config.snap
new file mode 100644
index 000000000..e64fda4c9
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_with_system_config.snap
@@ -0,0 +1,73 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - show
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+SYSTEM CONFIG [PROJECT_ID]
+  [merge]
+  squash = true
+  verify = true
+ 
+  [commit.generation]
+  command = "company-llm-tool"
+
+USER CONFIG ~/.config/worktrunk/config.toml
+  worktree-path = "../{{ repo }}.{{ branch }}"
+
+PROJECT CONFIG _REPO_/.config/wt.toml
+↳ Not found
+
+SHELL INTEGRATION
+▲ Shell integration not active
+  Invoked as: [PROJECT_ROOT]/target/debug/wt
+
+○ bash: Skipped; ~/.bashrc not found
+○ zsh: Skipped; ~/.zshrc not found
+○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
+
+CLAUDE CODE
+○ claude CLI not installed
+
+OTHER
+○ wt: [VERSION]
+○ git: [VERSION]
+○ Hyperlinks: inactive
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_correct_order.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_correct_order.snap
index f37c5c6ff..ffbe465d4 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_correct_order.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_correct_order.snap
@@ -25,11 +25,14 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_COMPINIT_CONFIGURED: "1"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_warning.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_warning.snap
index 6d9920644..cdbf90c2b 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_warning.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_warning.snap
@@ -25,11 +25,14 @@ info:
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_COMPINIT_MISSING: "1"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
diff --git a/tests/snapshots/integration__integration_tests__configure_shell__config_show_detects_fish_legacy_conf_d.snap b/tests/snapshots/integration__integration_tests__configure_shell__config_show_detects_fish_legacy_conf_d.snap
index bef5ca998..335bd2682 100644
--- a/tests/snapshots/integration__integration_tests__configure_shell__config_show_detects_fish_legacy_conf_d.snap
+++ b/tests/snapshots/integration__integration_tests__configure_shell__config_show_detects_fish_legacy_conf_d.snap
@@ -25,10 +25,13 @@ info:
SHELL: /bin/fish
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
diff --git a/tests/snapshots/integration__integration_tests__configure_shell__config_show_fish_legacy_with_functions_dir.snap b/tests/snapshots/integration__integration_tests__configure_shell__config_show_fish_legacy_with_functions_dir.snap
index 753dd9a31..0601243c0 100644
--- a/tests/snapshots/integration__integration_tests__configure_shell__config_show_fish_legacy_with_functions_dir.snap
+++ b/tests/snapshots/integration__integration_tests__configure_shell__config_show_fish_legacy_with_functions_dir.snap
@@ -25,10 +25,13 @@ info:
SHELL: /bin/fish
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_long.snap b/tests/snapshots/integration__integration_tests__help__help_config_long.snap
index 4a5e256db..b0e07c607 100644
--- a/tests/snapshots/integration__integration_tests__help__help_config_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_config_long.snap
@@ -17,6 +17,7 @@ info:
TERM: alacritty
WORKTRUNK_APPROVALS_PATH: /nonexistent/test/approvals.toml
WORKTRUNK_CONFIG_PATH: /nonexistent/test/config.toml
+ WORKTRUNK_SYSTEM_CONFIG_PATH: /etc/xdg/worktrunk/config.toml
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
@@ -80,6 +81,8 @@ Show current configuration and file locations:
User config ~/.config/worktrunk/config.toml Worktree path template, LLM commit configs, etc ✗
Project config .config/wt.toml Project hooks, dev server URL ✓
+Organizations can also deploy a system-wide config file for shared defaults — run wt config show for the platform-specific location.
+
User config — personal preferences:
# ~/.config/worktrunk/config.toml
@@ -358,6 +361,8 @@ Override the LLM command in CI to use a mock:
───────────────────────────────── ─────────────────────────────────────────────────────────────────────────────────
WORKTRUNK_BIN Override binary path for shell wrappers (useful for testing dev builds)
WORKTRUNK_CONFIG_PATH Override user config file location
+ WORKTRUNK_SYSTEM_CONFIG_PATH Override system config file location
+ XDG_CONFIG_DIRS Colon-separated system config directories (default: /etc/xdg)
WORKTRUNK_DIRECTIVE_FILE Internal: set by shell wrappers to enable directory changes
WORKTRUNK_SHELL Internal: set by shell wrappers to indicate shell type (e.g., powershell)
WORKTRUNK_MAX_CONCURRENT_COMMANDS Max parallel git commands (default: 32). Lower if hitting file descriptor limits.
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_show.snap b/tests/snapshots/integration__integration_tests__help__help_config_show.snap
index 08338e016..e87b3ee3c 100644
--- a/tests/snapshots/integration__integration_tests__help__help_config_show.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_config_show.snap
@@ -17,6 +17,7 @@ info:
SHELL: ""
TERM: alacritty
WORKTRUNK_CONFIG_PATH: /nonexistent/test/config.toml
+ WORKTRUNK_SYSTEM_CONFIG_PATH: /etc/xdg/worktrunk/config.toml
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
@@ -50,7 +51,7 @@ Usage: wt config show [OPTIONS]
Verbose output (-v: hooks, templates; -vv: debug report)
Shows location and contents of user config (~/.config/worktrunk/config.toml)
-and project config (.config/wt.toml).
+and project config (.config/wt.toml). Also shows system config if present.
If a config file doesn't exist, shows defaults that would be used.