claude-devkit-cli 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-devkit-cli",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "CLI toolkit for spec-first development with Claude Code — hooks, commands, guards, and test runners",
5
5
  "bin": {
6
6
  "claude-devkit": "./bin/devkit.js",
@@ -55,6 +55,37 @@ detect_swift_spm() {
55
55
  fi
56
56
  }
57
57
 
58
+ # Resolve a partial test name to a fully-qualified xcodebuild test ID.
59
+ # xcodebuild -only-testing requires: TestTarget/TestClass/methodName
60
+ # If FILTER already contains '/', treat as already qualified.
61
+ # Otherwise, grep Swift test files to find which class/struct contains the method.
62
+ resolve_xcode_filter() {
63
+ local filter="$1"
64
+ [[ "$filter" == *"/"* ]] && { echo "$filter"; return; }
65
+
66
+ # Find the Swift file containing this test method
67
+ local file
68
+ file=$(grep -rl "func ${filter}" --include="*.swift" . 2>/dev/null | head -1)
69
+ [[ -z "$file" ]] && { echo "$filter"; return; }
70
+
71
+ # Extract the class/struct name enclosing the method (handles @Test @MainActor etc.)
72
+ local class_line
73
+ class_line=$(awk '/^[[:space:]]*(final[[:space:]]+|open[[:space:]]+|public[[:space:]]+)*(class|struct)[[:space:]]/{cls=$0} \
74
+ /func '"$filter"'/{print cls; exit}' "$file")
75
+ [[ -z "$class_line" ]] && { echo "$filter"; return; }
76
+
77
+ local class_name
78
+ class_name=$(echo "$class_line" | awk '{for(i=1;i<=NF;i++) if($i=="class"||$i=="struct"){print $(i+1); exit}}' | tr -d '{:')
79
+ [[ -z "$class_name" ]] && { echo "$filter"; return; }
80
+
81
+ # Extract test target name from the file path (directory component ending in *Tests)
82
+ local target
83
+ target=$(echo "$file" | grep -oE '[^/]+(Tests|UITests)[^/]*' | head -1)
84
+ [[ -z "$target" ]] && { echo "$class_name/$filter"; return; }
85
+
86
+ echo "$target/$class_name/$filter"
87
+ }
88
+
58
89
  detect_swift_xcode() {
59
90
  local project=""
60
91
  local flag=""
@@ -78,7 +109,10 @@ detect_swift_xcode() {
78
109
  LANG_NAME="Swift (Xcode: $scheme)"
79
110
  TEST_CMD="xcodebuild test $flag '$project' -scheme '$scheme' -destination 'platform=macOS,arch=arm64'"
80
111
  if [[ -n "$FILTER" ]]; then
81
- TEST_CMD="$TEST_CMD -only-testing:'$FILTER'"
112
+ local qualified
113
+ qualified=$(resolve_xcode_filter "$FILTER")
114
+ info "Filter resolved: '$FILTER' → '$qualified'"
115
+ TEST_CMD="$TEST_CMD -only-testing:'$qualified'"
82
116
  fi
83
117
  }
84
118