Skip to content

feat(config): add WORKTRUNK_PROJECT_CONFIG_PATH override - #2267

Merged
max-sixty merged 1 commit into
mainfrom
project-config-env
Apr 16, 2026
Merged

max-sixty merged 1 commit into
mainfrom
project-config-env

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Adds a `WORKTRUNK_PROJECT_CONFIG_PATH` environment variable that overrides the project config path, mirroring the existing `WORKTRUNK_CONFIG_PATH` (user) and `WORKTRUNK_SYSTEM_CONFIG_PATH` (system) overrides. Missing files at the overridden path resolve to no project config — same as a missing `.config/wt.toml` today.

Uses it to fully isolate completion tests in `tests/integration_tests/shell_wrapper.rs`, which previously only isolated user and system config. After #2266 made aliases appear as top-level completion candidates at `wt `, any `[aliases]` added to this repo's own `.config/wt.toml` would silently pollute completion snapshots. The helper `set_empty_user_config` is renamed `set_empty_configs` and now points all three env vars at `/dev/null`.

Also cleans up `wt config show --format=json` to use `project_config_path()` for the `project.path` field (was hardcoded `.config/wt.toml`), so the override is reflected in both path and config.

`configure_cli_command` intentionally leaves `WORKTRUNK_PROJECT_CONFIG_PATH` unset — the `WORKTRUNK_*` env_remove loop prevents host leakage, and setting it would break tests that rely on the default `.config/wt.toml` lookup in their own test repo. Completion tests opt in explicitly via `set_empty_configs`.

Test plan

  • `cargo run --quiet --bin wt -- hook pre-merge --yes` — 3222/3222 green
  • New integration test `test_project_config_path_env_var_override` covers override-to-different-file and override-to-missing-file

Adds a `WORKTRUNK_PROJECT_CONFIG_PATH` environment variable that
overrides the project config path, mirroring the existing
`WORKTRUNK_CONFIG_PATH` (user) and `WORKTRUNK_SYSTEM_CONFIG_PATH`
(system) overrides.

Uses it to fully isolate completion tests in `shell_wrapper.rs`, which
previously only isolated user and system config. After PR #2266 made
aliases appear as completion candidates, any `[aliases]` added to this
repo's own `.config/wt.toml` would silently pollute completion snapshots.

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit 5daf70d into main Apr 16, 2026
25 checks passed
@max-sixty
max-sixty deleted the project-config-env branch April 16, 2026 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants