@windyroad/voice-tone 0.1.3 → 0.1.4

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.
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env bats
2
+
3
+ # P004: voice-tone-enforce-edit.sh project-root check.
4
+
5
+ setup() {
6
+ SCRIPT_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
7
+ HOOK="$SCRIPT_DIR/voice-tone-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 "voice-tone project-root: absolute .tsx outside project exits 0" {
17
+ run run_hook_with_file "/Users/other/project/src/foo.tsx"
18
+ [ "$status" -eq 0 ]
19
+ [[ "$output" != *"BLOCKED"* ]]
20
+ }
@@ -35,6 +35,16 @@ if [ -z "$FILE_PATH" ]; then
35
35
  exit 0
36
36
  fi
37
37
 
38
+ # P004: Only gate files inside the project root.
39
+ case "$FILE_PATH" in
40
+ /*)
41
+ case "$FILE_PATH" in
42
+ "$PWD"/*) ;;
43
+ *) exit 0 ;;
44
+ esac
45
+ ;;
46
+ esac
47
+
38
48
  # Gate copy-bearing files
39
49
  case "$FILE_PATH" in
40
50
  *.html|*.jsx|*.tsx|*.vue|*.svelte|*.ejs|*.hbs) ;;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windyroad/voice-tone",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Voice and tone enforcement for user-facing copy",
5
5
  "bin": {
6
6
  "windyroad-voice-tone": "./bin/install.mjs"