@windyroad/tdd 0.2.0-preview.52 → 0.2.1-preview.56

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.
@@ -16,6 +16,16 @@ if [ -z "$FILE_PATH" ]; then
16
16
  exit 0
17
17
  fi
18
18
 
19
+ # P004: Only gate files inside the project root.
20
+ case "$FILE_PATH" in
21
+ /*)
22
+ case "$FILE_PATH" in
23
+ "$PWD"/*) ;;
24
+ *) exit 0 ;;
25
+ esac
26
+ ;;
27
+ esac
28
+
19
29
  # Classify first, then check test script (only impl files need gating)
20
30
  FILE_TYPE=$(tdd_classify_file "$FILE_PATH")
21
31
  if [ "$FILE_TYPE" != "impl" ]; then
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env bats
2
+
3
+ # P004: tdd-enforce-edit.sh project-root check.
4
+
5
+ setup() {
6
+ SCRIPT_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
7
+ HOOK="$SCRIPT_DIR/tdd-enforce-edit.sh"
8
+ }
9
+
10
+ run_hook_with_file() {
11
+ local file_path="$1"
12
+ local json="{\"tool_input\":{\"file_path\":\"${file_path}\"},\"session_id\":\"test-$$\"}"
13
+ echo "$json" | bash "$HOOK"
14
+ }
15
+
16
+ @test "tdd project-root: absolute .ts outside project exits 0" {
17
+ run run_hook_with_file "/Users/other/project/src/foo.ts"
18
+ [ "$status" -eq 0 ]
19
+ [[ "$output" != *"BLOCKED"* ]]
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windyroad/tdd",
3
- "version": "0.2.0-preview.52",
3
+ "version": "0.2.1-preview.56",
4
4
  "description": "TDD state machine enforcement (Red-Green-Refactor cycle)",
5
5
  "bin": {
6
6
  "windyroad-tdd": "./bin/install.mjs"