@windyroad/jtbd 0.3.0-preview.52 → 0.3.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.
|
@@ -36,6 +36,17 @@ if [ -z "$FILE_PATH" ]; then
|
|
|
36
36
|
exit 0
|
|
37
37
|
fi
|
|
38
38
|
|
|
39
|
+
# P004: Only gate files inside the project root. Absolute paths outside
|
|
40
|
+
# $PWD (e.g., ~/.claude/channels/*) are not project files.
|
|
41
|
+
case "$FILE_PATH" in
|
|
42
|
+
/*)
|
|
43
|
+
case "$FILE_PATH" in
|
|
44
|
+
"$PWD"/*) ;;
|
|
45
|
+
*) exit 0 ;;
|
|
46
|
+
esac
|
|
47
|
+
;;
|
|
48
|
+
esac
|
|
49
|
+
|
|
39
50
|
BASENAME=$(basename "$FILE_PATH")
|
|
40
51
|
|
|
41
52
|
# Exclude non-JTBD files (matches architect gate exclusions)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env bats
|
|
2
|
+
|
|
3
|
+
# P004: jtbd-enforce-edit.sh project-root check.
|
|
4
|
+
|
|
5
|
+
setup() {
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
|
|
7
|
+
HOOK="$SCRIPT_DIR/jtbd-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 "jtbd project-root: absolute path outside project exits 0" {
|
|
17
|
+
run run_hook_with_file "/Users/other/somewhere/file.json"
|
|
18
|
+
[ "$status" -eq 0 ]
|
|
19
|
+
[[ "$output" != *"BLOCKED"* ]]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@test "jtbd project-root: home-dir config path exits 0" {
|
|
23
|
+
run run_hook_with_file "/Users/somebody/.claude/channels/discord/access.json"
|
|
24
|
+
[ "$status" -eq 0 ]
|
|
25
|
+
[[ "$output" != *"BLOCKED"* ]]
|
|
26
|
+
}
|