From 13d980f250ceef8efe0e91e4771e8d9a3aa95c8c Mon Sep 17 00:00:00 2001 From: "David Andrews (LexGenius.ai)" Date: Thu, 16 Jul 2026 10:37:09 -0400 Subject: [PATCH] test(hook): cover option-bearing uv runs in Claude chains --- src/discover/registry.rs | 4 ++++ src/hooks/hook_cmd.rs | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/discover/registry.rs b/src/discover/registry.rs index 6a7e9e89f..6eac50c01 100644 --- a/src/discover/registry.rs +++ b/src/discover/registry.rs @@ -2576,6 +2576,10 @@ mod tests { rewrite_command_no_prefixes("uv run --unknown pytest tests/", &[]), Some("rtk uv run --unknown pytest tests/".into()) ); + assert_eq!( + rewrite_command_no_prefixes("uv run --extra dev pytest tests/ -q", &[]), + Some("rtk uv run --extra dev pytest tests/ -q".into()) + ); assert_eq!( rewrite_command_no_prefixes("uv run -m pytest -q", &[]), Some("rtk uv run -m pytest -q".into()) diff --git a/src/hooks/hook_cmd.rs b/src/hooks/hook_cmd.rs index 40451b93c..0bbe88a3a 100644 --- a/src/hooks/hook_cmd.rs +++ b/src/hooks/hook_cmd.rs @@ -1117,6 +1117,22 @@ mod tests { assert_eq!(cmd, "rtk git add . && rtk cargo test"); } + #[test] + fn test_claude_compound_uv_run_with_options() { + // Claude Code frequently combines setup and option-bearing uv runs in one Bash call. + let input = "cd /repo && uv run --extra dev pytest tests/ -q 2>&1 | tail -12"; + let result = run_claude_inner(&claude_input(input)).unwrap(); + let v: Value = serde_json::from_str(&result).unwrap(); + let cmd = v + .pointer("/hookSpecificOutput/updatedInput/command") + .and_then(|c| c.as_str()) + .unwrap(); + assert_eq!( + cmd, + "cd /repo && rtk uv run --extra dev pytest tests/ -q 2>&1 | tail -12" + ); + } + #[test] fn test_claude_json_output_structure() { let result = run_claude_inner(&claude_input("git status")).unwrap();