@windyroad/architect 0.1.4-preview.52 → 0.1.5-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.
@@ -20,6 +20,17 @@ if [ -z "$FILE_PATH" ]; then
20
20
  exit 0
21
21
  fi
22
22
 
23
+ # P004: Only gate files inside the project root. Absolute paths outside
24
+ # $PWD (e.g., ~/.claude/channels/*) are not project files.
25
+ case "$FILE_PATH" in
26
+ /*)
27
+ case "$FILE_PATH" in
28
+ "$PWD"/*) ;;
29
+ *) exit 0 ;;
30
+ esac
31
+ ;;
32
+ esac
33
+
23
34
  # Only gate if the project has architecture decisions
24
35
  if [ ! -d "docs/decisions" ]; then
25
36
  exit 0
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bats
2
+
3
+ # Tests for architect-enforce-edit.sh project-root check (P004).
4
+ # Verifies that absolute paths outside $PWD are exempted.
5
+
6
+ setup() {
7
+ SCRIPT_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
8
+ HOOK="$SCRIPT_DIR/architect-enforce-edit.sh"
9
+ ORIG_DIR="$PWD"
10
+ }
11
+
12
+ teardown() {
13
+ cd "$ORIG_DIR"
14
+ }
15
+
16
+ run_hook_with_file() {
17
+ local file_path="$1"
18
+ local json="{\"tool_input\":{\"file_path\":\"${file_path}\"},\"session_id\":\"test-session-$$\"}"
19
+ echo "$json" | bash "$HOOK"
20
+ }
21
+
22
+ @test "project-root: absolute path outside project exits 0" {
23
+ run run_hook_with_file "/Users/other/somewhere/file.json"
24
+ [ "$status" -eq 0 ]
25
+ [[ "$output" != *"BLOCKED"* ]]
26
+ }
27
+
28
+ @test "project-root: home-dir config path exits 0" {
29
+ run run_hook_with_file "/Users/somebody/.claude/channels/discord/access.json"
30
+ [ "$status" -eq 0 ]
31
+ [[ "$output" != *"BLOCKED"* ]]
32
+ }
33
+
34
+ @test "project-root: absolute path inside \$PWD is still gated" {
35
+ # Use a temp dir as PWD with docs/decisions to trigger the gate
36
+ TEST_DIR=$(mktemp -d)
37
+ mkdir -p "$TEST_DIR/docs/decisions"
38
+ echo "# ADR" > "$TEST_DIR/docs/decisions/001-test.proposed.md"
39
+ cd "$TEST_DIR"
40
+ run run_hook_with_file "$TEST_DIR/src/index.ts"
41
+ [ "$status" -eq 0 ]
42
+ [[ "$output" == *"BLOCKED"* ]]
43
+ rm -rf "$TEST_DIR"
44
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windyroad/architect",
3
- "version": "0.1.4-preview.52",
3
+ "version": "0.1.5-preview.56",
4
4
  "description": "Architecture decision enforcement for AI coding agents",
5
5
  "bin": {
6
6
  "windyroad-architect": "./bin/install.mjs"