Skip to content

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

Move dev-detach to separate workspace package for dist compatibility

Maximilian Roos1377e2c733b4
diff --git a/Cargo.lock b/Cargo.lock
index 1749c2704..8c2308272 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -729,6 +729,13 @@ dependencies = [
"syn",
]
+[[package]]
+name = "dev-detach"
+version = "0.1.0"
+dependencies = [
+ "nix 0.30.1",
+]
+
[[package]]
name = "digest"
version = "0.10.7"
@@ -2958,7 +2965,6 @@ dependencies = [
"insta-cmd",
"log",
"minijinja",
- "nix 0.30.1",
"normalize-path",
"osc8",
"portable-pty",
diff --git a/Cargo.toml b/Cargo.toml
index 610c8035a..eff3f39a7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
[workspace]
-members = ["tests/helpers/setup-select-test"]
+members = ["tests/helpers/setup-select-test", "tests/helpers/dev-detach"]
[package]
name = "worktrunk"
@@ -25,8 +25,8 @@ consolidate-commits = true
default = ["syntax-highlighting"]
syntax-highlighting = ["dep:tree-sitter", "dep:tree-sitter-bash", "dep:tree-sitter-highlight"]
# Enable shell integration tests (requires bash, zsh, fish installed on system)
-# Also builds dev-detach helper binary for TTY isolation
-shell-integration-tests = ["dep:nix"]
+# Uses dev-detach helper binary from workspace for TTY isolation
+shell-integration-tests = []
[lib]
name = "worktrunk"
@@ -36,12 +36,6 @@ path = "src/lib.rs"
name = "wt"
path = "src/main.rs"
-# Test helper for TTY isolation in shell integration tests (Unix only)
-# Excluded from `cargo install` via required-features
-[[bin]]
-name = "dev-detach"
-path = "tests/bin/dev-detach.rs"
-required-features = ["shell-integration-tests"]
[dependencies]
anyhow = "1.0"
@@ -87,8 +81,6 @@ which = "7.0"
[target.'cfg(unix)'.dependencies]
skim = "0.20"
-# Used by dev-detach binary for TTY isolation in shell integration tests (optional)
-nix = { version = "0.30", optional = true, default-features = false, features = ["process"] }
[build-dependencies]
vergen-gitcl = { version = "1.0.8", features = ["build"] }
diff --git a/tests/common/shell.rs b/tests/common/shell.rs
index deb2f86d5..5439809ac 100644
--- a/tests/common/shell.rs
+++ b/tests/common/shell.rs
@@ -55,9 +55,9 @@ pub fn shell_available(shell: &str) -> bool {
AVAILABLE_SHELLS.contains(shell)
}
-/// Path to dev-detach binary (built automatically as part of the crate).
-/// The binary is gated behind the `shell-integration-tests` feature.
-const DEV_DETACH_BIN: &str = env!("CARGO_BIN_EXE_dev-detach");
+/// Path to dev-detach binary (workspace member built automatically by cargo).
+static DEV_DETACH_BIN: LazyLock<std::path::PathBuf> =
+ LazyLock::new(|| get_cargo_bin("dev-detach"));
/// Convert signal number to human-readable name
#[cfg(unix)]
@@ -87,7 +87,7 @@ pub fn get_shell_binary(shell: &str) -> &str {
/// Build a command to execute a shell script via dev-detach.
fn build_shell_command(repo: &TestRepo, shell: &str, script: &str) -> Command {
- let mut cmd = Command::new(DEV_DETACH_BIN);
+ let mut cmd = Command::new(&*DEV_DETACH_BIN);
repo.clean_cli_env(&mut cmd);
// Prevent user shell config from leaking into tests
diff --git a/tests/helpers/dev-detach/Cargo.toml b/tests/helpers/dev-detach/Cargo.toml
new file mode 100644
index 000000000..054767f5b
--- /dev/null
+++ b/tests/helpers/dev-detach/Cargo.toml
@@ -0,0 +1,11 @@
+# Helper binary for TTY isolation in shell integration tests.
+# This is a workspace member (not a separate workspace) to share target/ and Cargo.lock.
+# Never published to crates.io (publish = false) - only used during testing.
+[package]
+name = "dev-detach"
+version = "0.1.0"
+edition = "2024"
+publish = false
+
+[target.'cfg(unix)'.dependencies]
+nix = { version = "0.30", default-features = false, features = ["process"] }
diff --git a/tests/bin/dev-detach.rs b/tests/helpers/dev-detach/src/main.rs
similarity index 100%
rename from tests/bin/dev-detach.rs
rename to tests/helpers/dev-detach/src/main.rs