Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Make dev-detach a compile-time dependency (#123)
Maximilian Roos689af2e1f7bb
diff --git a/.config/wt.toml b/.config/wt.tomlindex 9630dde3e..9f15ad393 100644--- a/.config/wt.toml+++ b/.config/wt.toml@@ -41,7 +41,5 @@ pre-commit = "pre-commit run --all-files"# Note: This must come AFTER post-merge because [pre-merge] starts# a TOML table section, and everything after it would be inside that section[pre-merge]-# Build test helpers first (dev-detach isn't a compile-time dependency)-build = "cargo build -p dev-detach"insta = "NEXTEST_STATUS_LEVEL=fail NEXTEST_SUCCESS_OUTPUT=never cargo insta test --dnd --check --features shell-integration-tests"doc = "RUSTDOCFLAGS='-Dwarnings' cargo doc --no-deps"diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yamlindex 6a1d82261..065bcb5dd 100644--- a/.github/workflows/ci.yaml+++ b/.github/workflows/ci.yaml@@ -67,10 +67,6 @@ jobs:command: testargs: --no-run --locked ${{ runner.os != 'Windows' && '--features shell-integration-tests' || '' }}- - name: 🔧 Build test helpers- if: runner.os != 'Windows'- run: cargo build -p dev-detach-- name: 📋 Testuses: clechasseur/rs-cargo@v4timeout-minutes: 10diff --git a/Cargo.lock b/Cargo.lockindex 6677d3118..954c2d548 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -729,13 +729,6 @@ dependencies = ["syn",]-[[package]]-name = "dev-detach"-version = "0.1.0"-dependencies = [- "nix 0.30.1",-]-[[package]]name = "digest"version = "0.10.7"@@ -2964,6 +2957,7 @@ dependencies = ["insta-cmd","log","minijinja",+ "nix 0.30.1","normalize-path","osc8","portable-pty",diff --git a/Cargo.toml b/Cargo.tomlindex 881989e9f..76e7e08c4 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -1,5 +1,5 @@[workspace]-members = ["tests/helpers/setup-select-test", "tests/helpers/dev-detach"]+members = ["tests/helpers/setup-select-test"][package]name = "worktrunk"@@ -25,7 +25,8 @@ consolidate-commits = truedefault = ["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)-shell-integration-tests = []+# Also builds dev-detach helper binary for TTY isolation+shell-integration-tests = ["dep:nix"][lib]name = "worktrunk"@@ -35,6 +36,13 @@ 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"anstream = "0.6"@@ -77,6 +85,8 @@ normalize-path = "0.2.1"[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/helpers/dev-detach/src/main.rs b/tests/bin/dev-detach.rssimilarity index 100%rename from tests/helpers/dev-detach/src/main.rsrename to tests/bin/dev-detach.rsdiff --git a/tests/common/shell.rs b/tests/common/shell.rsindex 79c1ac195..1707e5a2a 100644--- a/tests/common/shell.rs+++ b/tests/common/shell.rs@@ -1,9 +1,10 @@use super::{TestRepo, wt_command};use insta_cmd::get_cargo_bin;-use std::{path::PathBuf, process::Command, sync::LazyLock};+use std::process::Command;-/// Path to dev-detach binary (workspace member in tests/helpers/dev-detach).-static DEV_DETACH_BIN: LazyLock<PathBuf> = LazyLock::new(|| get_cargo_bin("dev-detach"));+/// 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");/// Convert signal number to human-readable name#[cfg(unix)]@@ -33,7 +34,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.as_os_str());+ let mut cmd = Command::new(DEV_DETACH_BIN);repo.clean_cli_env(&mut cmd);// Prevent user shell config from leaking into testsdiff --git a/tests/helpers/dev-detach/Cargo.toml b/tests/helpers/dev-detach/Cargo.tomldeleted file mode 100644index ecfc1a5c2..000000000--- a/tests/helpers/dev-detach/Cargo.toml+++ /dev/null@@ -1,13 +0,0 @@-# 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 development.-[package]-name = "dev-detach"-version = "0.1.0"-edition = "2024"-publish = false--[dependencies]--[target.'cfg(unix)'.dependencies]-nix = { version = "0.30", default-features = false, features = ["process"] }