Skip to content

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

fix: anchor relative WORKTRUNK_PROJECT_CONFIG_PATH to the worktree root (#3460)

Maximilian Roosbb4abca109a0
diff --git a/docs/content/config.md b/docs/content/config.md
index 3939b5d49..9f39d534f 100644
--- a/docs/content/config.md
+++ b/docs/content/config.md
@@ -630,7 +630,7 @@ 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 |
-| `WORKTRUNK_PROJECT_CONFIG_PATH` | Override project config file location (defaults to `.config/wt.toml`) |
+| `WORKTRUNK_PROJECT_CONFIG_PATH` | Override project config file location (defaults to `.config/wt.toml`); relative paths resolve from the worktree root |
| `XDG_CONFIG_DIRS` | Colon-separated system config directories (default: `/etc/xdg`) |
| `WORKTRUNK_DIRECTIVE_CD_FILE` | Internal: set by shell wrappers. wt writes a raw path; the wrapper `cd`s to it |
| `WORKTRUNK_DIRECTIVE_EXEC_FILE` | Internal: set by shell wrappers. wt writes shell commands; the wrapper sources the file |
diff --git a/plugins/worktrunk/skills/worktrunk/reference/config.md b/plugins/worktrunk/skills/worktrunk/reference/config.md
index 09048e09b..bcacb330d 100644
--- a/plugins/worktrunk/skills/worktrunk/reference/config.md
+++ b/plugins/worktrunk/skills/worktrunk/reference/config.md
@@ -627,7 +627,7 @@ $ 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 |
-| `WORKTRUNK_PROJECT_CONFIG_PATH` | Override project config file location (defaults to `.config/wt.toml`) |
+| `WORKTRUNK_PROJECT_CONFIG_PATH` | Override project config file location (defaults to `.config/wt.toml`); relative paths resolve from the worktree root |
| `XDG_CONFIG_DIRS` | Colon-separated system config directories (default: `/etc/xdg`) |
| `WORKTRUNK_DIRECTIVE_CD_FILE` | Internal: set by shell wrappers. wt writes a raw path; the wrapper `cd`s to it |
| `WORKTRUNK_DIRECTIVE_EXEC_FILE` | Internal: set by shell wrappers. wt writes shell commands; the wrapper sources the file |
diff --git a/skills/worktrunk/reference/config.md b/skills/worktrunk/reference/config.md
index 09048e09b..bcacb330d 100644
--- a/skills/worktrunk/reference/config.md
+++ b/skills/worktrunk/reference/config.md
@@ -627,7 +627,7 @@ $ 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 |
-| `WORKTRUNK_PROJECT_CONFIG_PATH` | Override project config file location (defaults to `.config/wt.toml`) |
+| `WORKTRUNK_PROJECT_CONFIG_PATH` | Override project config file location (defaults to `.config/wt.toml`); relative paths resolve from the worktree root |
| `XDG_CONFIG_DIRS` | Colon-separated system config directories (default: `/etc/xdg`) |
| `WORKTRUNK_DIRECTIVE_CD_FILE` | Internal: set by shell wrappers. wt writes a raw path; the wrapper `cd`s to it |
| `WORKTRUNK_DIRECTIVE_EXEC_FILE` | Internal: set by shell wrappers. wt writes shell commands; the wrapper sources the file |
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 4b7810a69..9f252d2dc 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -2478,7 +2478,7 @@ $ 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 |
-| `WORKTRUNK_PROJECT_CONFIG_PATH` | Override project config file location (defaults to `.config/wt.toml`) |
+| `WORKTRUNK_PROJECT_CONFIG_PATH` | Override project config file location (defaults to `.config/wt.toml`); relative paths resolve from the worktree root |
| `XDG_CONFIG_DIRS` | Colon-separated system config directories (default: `/etc/xdg`) |
| `WORKTRUNK_DIRECTIVE_CD_FILE` | Internal: set by shell wrappers. wt writes a raw path; the wrapper `cd`s to it |
| `WORKTRUNK_DIRECTIVE_EXEC_FILE` | Internal: set by shell wrappers. wt writes shell commands; the wrapper sources the file |
diff --git a/src/commands/config/show.rs b/src/commands/config/show.rs
index 34514e78d..1a249a2f6 100644
--- a/src/commands/config/show.rs
+++ b/src/commands/config/show.rs
@@ -798,15 +798,15 @@ fn render_project_config(out: &mut String) -> anyhow::Result<()> {
return Ok(());
}
};
- let config_path = match repo.project_config_path() {
- Ok(Some(path)) => path,
- _ => {
+ let config_path = match repo.project_config_path()? {
+ Some(path) => path,
+ None => {
writeln!(
out,
"{}",
cformat!(
"<dim>{}</>",
- format_heading("PROJECT CONFIG", Some("Not in a git repository"))
+ format_heading("PROJECT CONFIG", Some("No project config"))
)
)?;
return Ok(());
diff --git a/src/commands/config/update.rs b/src/commands/config/update.rs
index bd27b2d77..db5d8332a 100644
--- a/src/commands/config/update.rs
+++ b/src/commands/config/update.rs
@@ -183,9 +183,9 @@ fn check_project_config() -> anyhow::Result<Option<UpdateCandidate>> {
Err(_) => return Ok(None),
};
- let config_path = match repo.project_config_path() {
- Ok(Some(path)) => path,
- _ => return Ok(None),
+ let config_path = match repo.project_config_path()? {
+ Some(path) => path,
+ None => return Ok(None),
};
if !config_path.exists() {
return Ok(None);
diff --git a/src/git/repository/config.rs b/src/git/repository/config.rs
index 7e34a6ec3..d9d701a67 100644
--- a/src/git/repository/config.rs
+++ b/src/git/repository/config.rs
@@ -631,18 +631,25 @@ impl Repository {
///
/// If `WORKTRUNK_PROJECT_CONFIG_PATH` is set, returns that path (used for
/// test isolation so the spawned `wt` does not pick up this repo's
- /// `.config/wt.toml`). A missing file at that path still resolves to
- /// `Ok(None)` via `ProjectConfig::load`, matching the no-config case.
- ///
- /// Otherwise: uses the current worktree when inside one (both normal and
- /// bare repos). For bare repos at the bare root (outside any worktree),
- /// falls back to the primary worktree. When the default branch is checked
- /// out in no worktree (so `primary_worktree()` is `None`), there is no
- /// on-disk path to return here — `ProjectConfig::load` reads the committed
- /// default-branch config from the object store via
+ /// `.config/wt.toml`). An empty value means no project config. A relative
+ /// value resolves against the same worktree root the default
+ /// `.config/wt.toml` is anchored to — never the process cwd, which would
+ /// make the override silently depend on the invocation directory — and
+ /// errors when no worktree root exists to anchor it. A missing file at the
+ /// resulting path still resolves to `Ok(None)` via `ProjectConfig::load`,
+ /// matching the no-config case.
+ ///
+ /// Without the override: uses the current worktree when inside one (both
+ /// normal and bare repos). For bare repos at the bare root (outside any
+ /// worktree), falls back to the primary worktree. When the default branch
+ /// is checked out in no worktree (so `primary_worktree()` is `None`),
+ /// there is no on-disk path to return here — `ProjectConfig::load` reads
+ /// the committed default-branch config from the object store via
/// [`default_branch_project_config_content`](Self::default_branch_project_config_content)
/// so project config (and every project hook) isn't silently dropped while
- /// the primary is parked on another branch (#3461).
+ /// the primary is parked on another branch (#3461). That fallback is for
+ /// the no-override case only: an override always names the config source
+ /// outright.
///
/// "The current worktree" is whatever this `Repository` was rooted at, so
/// the answer to "which `.config/wt.toml` does a hook read" is decided by
@@ -650,8 +657,34 @@ impl Repository {
/// is resolved against — is the spec in the `commands::hooks` module docs
/// (`src/commands/hooks.rs`).
pub fn project_config_path(&self) -> anyhow::Result<Option<PathBuf>> {
- if let Ok(path) = std::env::var("WORKTRUNK_PROJECT_CONFIG_PATH") {
- return Ok(Some(PathBuf::from(path)));
+ let override_path = std::env::var_os("WORKTRUNK_PROJECT_CONFIG_PATH").map(PathBuf::from);
+ if let Some(path) = &override_path {
+ if path.as_os_str().is_empty() {
+ // An empty override means no project config, matching a
+ // missing file at the override path.
+ return Ok(None);
+ }
+ if path.is_absolute() {
+ return Ok(Some(path.clone()));
+ }
+ // Windows-only forms that are neither absolute nor purely
+ // relative — drive-relative (`C:cfg`) or rooted without a drive
+ // (`\cfg`, `/tmp/x`) — would resolve against the process drive or
+ // replace the anchor under `Path::join`; reject them rather than
+ // silently keep the cwd dependence this resolution exists to
+ // eliminate.
+ #[cfg(windows)]
+ if path.has_root()
+ || matches!(
+ path.components().next(),
+ Some(std::path::Component::Prefix(_))
+ )
+ {
+ anyhow::bail!(
+ "WORKTRUNK_PROJECT_CONFIG_PATH ({}) is neither fully absolute nor relative; use an absolute path including the drive",
+ path.display()
+ );
+ }
}
// Batched rev-parse: asks `--is-inside-work-tree` and also pre-warms
@@ -659,26 +692,29 @@ impl Repository {
// forks on the typical alias path.
let info = self.current_worktree().prewarm_info().unwrap_or_default();
- if let Some(root) = info.root {
- // Inside a worktree — use it (normal repo or linked worktree in
- // bare repo). `root` is `Some` iff the batch saw us inside a work
- // tree, so no separate `is_inside` check.
- return Ok(Some(root.join(".config").join("wt.toml")));
- }
-
- if self.is_bare().unwrap_or(false) {
- // At bare repo root — use the primary worktree (the one holding the
- // default branch). When the default branch is checked out in no
- // worktree, `primary_worktree()` is `None` and there is no on-disk
- // path; `ProjectConfig::load` then reads the committed
- // default-branch config from the object store via
- // `default_branch_project_config_content` (#3461).
- return Ok(self
- .primary_worktree()?
- .map(|p| p.join(".config").join("wt.toml")));
- }
+ // Inside a worktree — use it (normal repo or linked worktree in bare
+ // repo; `root` is `Some` iff the batch saw us inside a work tree). At
+ // the bare root, fall back to the primary worktree (the one holding
+ // the default branch); when the default branch is checked out in no
+ // worktree, there is no root and no on-disk path — `ProjectConfig::load`
+ // then reads the committed default-branch config from the object store
+ // via `default_branch_project_config_content` (#3461).
+ let root = match info.root {
+ Some(root) => Some(root),
+ None if self.is_bare().unwrap_or(false) => self.primary_worktree()?,
+ None => None,
+ };
- Ok(None)
+ let Some(relative) = override_path else {
+ return Ok(root.map(|root| root.join(".config").join("wt.toml")));
+ };
+ let Some(root) = root else {
+ anyhow::bail!(
+ "WORKTRUNK_PROJECT_CONFIG_PATH is relative ({}) but there is no worktree root to resolve it against; use an absolute path",
+ relative.display()
+ );
+ };
+ Ok(Some(root.join(relative)))
}
/// Content of the default branch's committed `.config/wt.toml`, read from
@@ -724,6 +760,14 @@ impl Repository {
/// filesystem path. Nothing is read from or written to it; it only
/// annotates diagnostics (e.g. a parse error) with the object-store source.
pub fn default_branch_project_config_content(&self) -> Option<(String, PathBuf)> {
+ // An explicit WORKTRUNK_PROJECT_CONFIG_PATH override names the config
+ // source outright — an empty value or a missing file at the override
+ // path means no project config — so the committed fallback must not
+ // supersede it (the override exists for test isolation, where reading
+ // the repo's own committed config is exactly the leak being prevented).
+ if std::env::var_os("WORKTRUNK_PROJECT_CONFIG_PATH").is_some() {
+ return None;
+ }
if !self.is_bare().unwrap_or(false) {
return None;
}
diff --git a/tests/integration_tests/bare_repository.rs b/tests/integration_tests/bare_repository.rs
index afc6f94ac..95d4c9fe8 100644
--- a/tests/integration_tests/bare_repository.rs
+++ b/tests/integration_tests/bare_repository.rs
@@ -968,6 +968,66 @@ fn test_bare_repo_no_project_config_when_primary_off_branch_and_none_present() {
);
}
+#[test]
+fn test_bare_repo_committed_config_does_not_supersede_override() {
+ // Companion to the #3461 fix: the object-store fallback must never
+ // supersede an explicit `WORKTRUNK_PROJECT_CONFIG_PATH`. The override
+ // names the config source outright — a missing file there means no
+ // project config — and it exists for test isolation, where reading the
+ // repo's own committed config is exactly the leak being prevented.
+ let test = BareRepoTest::new();
+
+ // Commit a project config on the default branch, then park the primary
+ // worktree off it — the state where the committed fallback applies.
+ let main_worktree = test.create_worktree("main", "main");
+ test.commit_in(&main_worktree, "Initial commit");
+ let config_dir = main_worktree.join(".config");
+ fs::create_dir_all(&config_dir).unwrap();
+ fs::write(
+ config_dir.join("wt.toml"),
+ "pre-start = \"echo committed\"\n",
+ )
+ .unwrap();
+ let output = test
+ .git_command(&main_worktree)
+ .args(["add", ".config/wt.toml"])
+ .run()
+ .unwrap();
+ assert!(output.status.success());
+ test.commit_in(&main_worktree, "Add project config");
+ let output = test
+ .git_command(&main_worktree)
+ .args(["checkout", "-b", "feature-x"])
+ .run()
+ .unwrap();
+ assert!(
+ output.status.success(),
+ "checkout -b feature-x failed: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+
+ let mut cmd = test.wt_command();
+ cmd.env(
+ "WORKTRUNK_PROJECT_CONFIG_PATH",
+ test.temp_path().join("nonexistent.toml"),
+ );
+ cmd.args(["config", "show", "--format=json"])
+ .current_dir(test.bare_repo_path());
+ let output = cmd.output().unwrap();
+ assert!(
+ output.status.success(),
+ "stderr: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ let json: serde_json::Value =
+ serde_json::from_str(&String::from_utf8_lossy(&output.stdout)).unwrap();
+ assert!(
+ json["project"]["config"].is_null(),
+ "an override pointing at a missing file must not fall back to the committed config, got: {}",
+ json["project"]["config"]
+ );
+}
+
#[test]
fn test_bare_repo_project_config_found_from_linked_worktree_when_primary_off_branch() {
// Regression for the #3461 fix: the object-store fallback must resolve the
diff --git a/tests/integration_tests/config_show.rs b/tests/integration_tests/config_show.rs
index b24b714a5..13d09626a 100644
--- a/tests/integration_tests/config_show.rs
+++ b/tests/integration_tests/config_show.rs
@@ -1,5 +1,5 @@
use crate::common::{
- TestRepo, canonical_temp_home, repo, set_temp_home_env, set_xdg_config_path,
+ BareRepoTest, TestRepo, canonical_temp_home, repo, set_temp_home_env, set_xdg_config_path,
setup_home_snapshot_settings, setup_snapshot_settings, setup_snapshot_settings_with_home,
temp_home, wt_command,
};
@@ -5085,4 +5085,166 @@ fn test_project_config_path_env_var_override(repo: TestRepo, temp_home: TempDir)
"missing override path should resolve to no project config, got: {}",
json["project"]["config"]
);
+
+ // An empty override likewise means no project config — it must not fall
+ // back to the repo's own file or resolve to the worktree root directory.
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ set_xdg_config_path(&mut cmd, temp_home.path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+ cmd.env("WORKTRUNK_PROJECT_CONFIG_PATH", "");
+ cmd.args(["config", "show", "--format=json"])
+ .current_dir(repo.root_path());
+
+ let output = cmd.output().unwrap();
+ assert!(
+ output.status.success(),
+ "stderr: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ let json: serde_json::Value =
+ serde_json::from_str(&String::from_utf8_lossy(&output.stdout)).unwrap();
+ assert!(
+ json["project"]["config"].is_null(),
+ "empty override should resolve to no project config, got: {}",
+ json["project"]["config"]
+ );
+}
+
+/// A relative `WORKTRUNK_PROJECT_CONFIG_PATH` resolves against the worktree
+/// root — the same anchor as the default `.config/wt.toml` — so the override
+/// behaves identically from any subdirectory instead of silently depending on
+/// the process cwd, and each worktree anchors to its own root.
+#[rstest]
+fn test_project_config_path_env_var_relative(mut repo: TestRepo, temp_home: TempDir) {
+ fs::write(
+ repo.root_path().join("custom-wt.toml"),
+ "pre-start = \"custom-hook\"\n",
+ )
+ .unwrap();
+ let subdir = repo.root_path().join("sub");
+ fs::create_dir_all(&subdir).unwrap();
+
+ // A linked worktree carries its own config file at the same relative
+ // location; running there must load that file, not the main worktree's.
+ let linked = repo.add_worktree("linked-anchor");
+ fs::write(
+ linked.join("custom-wt.toml"),
+ "pre-start = \"linked-hook\"\n",
+ )
+ .unwrap();
+
+ let cases = [
+ (
+ repo.root_path().to_path_buf(),
+ repo.root_path().to_path_buf(),
+ "custom-hook",
+ ),
+ (subdir, repo.root_path().to_path_buf(), "custom-hook"),
+ (linked.clone(), linked, "linked-hook"),
+ ];
+ for (cwd, expected_root, expected_hook) in &cases {
+ let mut cmd = repo.wt_command();
+ set_xdg_config_path(&mut cmd, temp_home.path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+ cmd.env("WORKTRUNK_PROJECT_CONFIG_PATH", "custom-wt.toml");
+ cmd.args(["config", "show", "--format=json"])
+ .current_dir(cwd);
+
+ let output = cmd.output().unwrap();
+ assert!(
+ output.status.success(),
+ "stderr: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ let json: serde_json::Value =
+ serde_json::from_str(&String::from_utf8_lossy(&output.stdout)).unwrap();
+ assert_eq!(
+ json["project"]["path"].as_str().unwrap(),
+ expected_root.join("custom-wt.toml").to_str().unwrap(),
+ "relative override should anchor to the worktree root from {cwd:?}"
+ );
+ assert_eq!(
+ json["project"]["config"]["pre-start"], *expected_hook,
+ "relative override should load the root-anchored config from {cwd:?}, got: {}",
+ json["project"]
+ );
+ }
+}
+
+/// A relative `WORKTRUNK_PROJECT_CONFIG_PATH` with no worktree root to anchor
+/// it (bare repo, no linked worktrees) errors instead of silently resolving
+/// against the process cwd.
+#[test]
+fn test_project_config_path_env_var_relative_no_worktree_errors() {
+ let test = BareRepoTest::new();
+
+ let mut cmd = test.wt_command();
+ cmd.env("WORKTRUNK_PROJECT_CONFIG_PATH", "custom-wt.toml");
+ cmd.args(["config", "show", "--format=json"])
+ .current_dir(test.bare_repo_path());
+
+ let output = cmd.output().unwrap();
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ assert!(
+ !output.status.success(),
+ "a relative override without a worktree root should fail; stderr:\n{stderr}"
+ );
+ assert!(
+ stderr.contains("WORKTRUNK_PROJECT_CONFIG_PATH is relative"),
+ "error should name the env var and the problem; stderr:\n{stderr}"
+ );
+
+ // Without the override, the same repo has no project config location at
+ // all; `wt config update` skips the project config rather than erroring,
+ // and `wt config show` reports the absence rather than claiming to be
+ // outside a git repository.
+ let mut cmd = test.wt_command();
+ cmd.args(["config", "update", "--yes"])
+ .current_dir(test.bare_repo_path());
+ let output = cmd.output().unwrap();
+ assert!(
+ output.status.success(),
+ "config update should skip a missing project config location; stderr:\n{}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+
+ let mut cmd = test.wt_command();
+ cmd.args(["config", "show"])
+ .current_dir(test.bare_repo_path());
+ let output = cmd.output().unwrap();
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ assert!(
+ output.status.success(),
+ "config show should succeed with no project config location; stderr:\n{}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ assert!(
+ stdout.contains("No project config"),
+ "config show should report the missing project config location; stdout:\n{stdout}"
+ );
+}
+
+/// On Windows, an override that is neither fully absolute nor relative — a
+/// drive-relative (`C:cfg`) or rooted-but-driveless (`\cfg`) value — errors
+/// instead of silently resolving against the process drive or cwd.
+#[cfg(windows)]
+#[rstest]
+fn test_project_config_path_env_var_half_anchored_errors(repo: TestRepo) {
+ for value in [r"C:cfg\wt.toml", r"\cfg\wt.toml"] {
+ let mut cmd = repo.wt_command();
+ cmd.env("WORKTRUNK_PROJECT_CONFIG_PATH", value);
+ cmd.args(["config", "show", "--format=json"]);
+
+ let output = cmd.output().unwrap();
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ assert!(
+ !output.status.success(),
+ "override {value} should be rejected; stderr:\n{stderr}"
+ );
+ assert!(
+ stderr.contains("neither fully absolute nor relative"),
+ "error should explain the rejected form for {value}; stderr:\n{stderr}"
+ );
+ }
}
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 5b31fd7fc..6aaf3a911 100644
--- a/tests/snapshots/integration__integration_tests__help__help_config_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_config_long.snap
@@ -600,21 +600,21 @@ Override the LLM command in CI to use a mock:
Other environment variables
- Variable Purpose
- ───────────────────────────────── ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────
- 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
- WORKTRUNK_PROJECT_CONFIG_PATH Override project config file location (defaults to .config/wt.toml)
- XDG_CONFIG_DIRS Colon-separated system config directories (default: /etc/xdg)
- WORKTRUNK_DIRECTIVE_CD_FILE Internal: set by shell wrappers. wt writes a raw path; the wrapper cds to it
- WORKTRUNK_DIRECTIVE_EXEC_FILE Internal: set by shell wrappers. wt writes shell commands; the wrapper sources the file
- 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.
- WORKTRUNK_VERBOSE Verbosity level (0/1/2), like -v/-vv but applied everywhere — including shell completion, which no flag can reach
- RUST_LOG Logging directive (e.g. worktrunk=debug); overrides the verbosity baseline for what reaches stderr
- NO_COLOR Disable colored output (standard)
- CLICOLOR_FORCE Force colored output even when not a TTY
+ Variable Purpose
+ ───────────────────────────────── ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
+ 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
+ WORKTRUNK_PROJECT_CONFIG_PATH Override project config file location (defaults to .config/wt.toml); relative paths resolve from the worktree root
+ XDG_CONFIG_DIRS Colon-separated system config directories (default: /etc/xdg)
+ WORKTRUNK_DIRECTIVE_CD_FILE Internal: set by shell wrappers. wt writes a raw path; the wrapper cds to it
+ WORKTRUNK_DIRECTIVE_EXEC_FILE Internal: set by shell wrappers. wt writes shell commands; the wrapper sources the file
+ 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.
+ WORKTRUNK_VERBOSE Verbosity level (0/1/2), like -v/-vv but applied everywhere — including shell completion, which no flag can reach
+ RUST_LOG Logging directive (e.g. worktrunk=debug); overrides the verbosity baseline for what reaches stderr
+ NO_COLOR Disable colored output (standard)
+ CLICOLOR_FORCE Force colored output even when not a TTY
Inline config overrides (--config-set)