@windyroad/architect 0.2.0-preview.62 → 0.2.0-preview.70
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.
|
@@ -3,33 +3,60 @@
|
|
|
3
3
|
# Tests for architect-enforce-edit.sh — verifies peer-plugin policy files are
|
|
4
4
|
# exempt from the architect gate (P009). Each plugin governs its own policy
|
|
5
5
|
# docs via its own enforce hook; the architect should not re-gate them.
|
|
6
|
+
#
|
|
7
|
+
# All tests are functional (P011): they execute the hook with mock JSON
|
|
8
|
+
# input and assert on exit status + BLOCKED output. Source-grep assertions
|
|
9
|
+
# were removed because they over-specified the implementation and gave
|
|
10
|
+
# false confidence (a literal string can appear in source without the
|
|
11
|
+
# matching case branch actually short-circuiting).
|
|
6
12
|
|
|
7
13
|
setup() {
|
|
8
14
|
SCRIPT_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
|
|
9
15
|
HOOK="$SCRIPT_DIR/architect-enforce-edit.sh"
|
|
16
|
+
ORIG_DIR="$PWD"
|
|
17
|
+
TEST_DIR=$(mktemp -d)
|
|
18
|
+
cd "$TEST_DIR"
|
|
19
|
+
# Engage the gate: architect-enforce only runs when docs/decisions/ exists.
|
|
20
|
+
mkdir -p docs/decisions
|
|
10
21
|
}
|
|
11
22
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
23
|
+
teardown() {
|
|
24
|
+
cd "$ORIG_DIR"
|
|
25
|
+
rm -rf "$TEST_DIR"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
# Helper: run the hook with a mock JSON input for a given file path.
|
|
29
|
+
# Claude Code passes absolute file_path values, so tests use $PWD-prefixed
|
|
30
|
+
# paths to match real shape (after the P004 root check).
|
|
31
|
+
run_hook_with_file() {
|
|
32
|
+
local file_path="$1"
|
|
33
|
+
local json="{\"tool_input\":{\"file_path\":\"${file_path}\"},\"session_id\":\"test-session-$$\"}"
|
|
34
|
+
echo "$json" | bash "$HOOK"
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
assert_path_allowed() {
|
|
38
|
+
local file_path="$1"
|
|
39
|
+
run run_hook_with_file "$file_path"
|
|
40
|
+
[ "$status" -eq 0 ]
|
|
41
|
+
[[ "$output" != *"BLOCKED"* ]]
|
|
15
42
|
}
|
|
16
43
|
|
|
17
44
|
@test "architect: exempts JTBD policy file (P009)" {
|
|
18
|
-
|
|
45
|
+
assert_path_allowed "$PWD/docs/JOBS_TO_BE_DONE.md"
|
|
19
46
|
}
|
|
20
47
|
|
|
21
|
-
@test "architect: exempts JTBD directory (P009)" {
|
|
22
|
-
|
|
48
|
+
@test "architect: exempts JTBD directory file (P009)" {
|
|
49
|
+
assert_path_allowed "$PWD/docs/jtbd/solo-developer/persona.md"
|
|
23
50
|
}
|
|
24
51
|
|
|
25
52
|
@test "architect: exempts PRODUCT_DISCOVERY.md (P009)" {
|
|
26
|
-
|
|
53
|
+
assert_path_allowed "$PWD/docs/PRODUCT_DISCOVERY.md"
|
|
27
54
|
}
|
|
28
55
|
|
|
29
56
|
@test "architect: exempts voice-tone policy file (P009)" {
|
|
30
|
-
|
|
57
|
+
assert_path_allowed "$PWD/docs/VOICE-AND-TONE.md"
|
|
31
58
|
}
|
|
32
59
|
|
|
33
60
|
@test "architect: exempts style-guide policy file (P009)" {
|
|
34
|
-
|
|
61
|
+
assert_path_allowed "$PWD/docs/STYLE-GUIDE.md"
|
|
35
62
|
}
|