@windyroad/style-guide 0.3.1 → 0.4.0-preview.303

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "wr-style-guide",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Style guide enforcement for Claude Code"
5
5
  }
package/README.md CHANGED
@@ -45,6 +45,22 @@ This examines your existing CSS, components, and design patterns, then asks abou
45
45
 
46
46
  The `wr-style-guide:agent` reads your `docs/STYLE-GUIDE.md` and reviews proposed changes against your documented design system.
47
47
 
48
+ ## Jobs to be Done
49
+
50
+ This plugin serves the [Jobs to be Done](../../docs/jtbd/) below. Per [ADR-051](../../docs/decisions/051-jtbd-anchored-readme-with-drift-advisory.proposed.md), the persona-grouped JTBD anchor is the canonical source of truth for the README's value framing.
51
+
52
+ ### Solo developer
53
+
54
+ - **[JTBD-001 Enforce Governance Without Slowing Down](../../docs/jtbd/solo-developer/JTBD-001-enforce-governance.proposed.md)** — style-guide review fires automatically on every CSS or component edit; the project's own design system is the policy source.
55
+
56
+ ### Tech lead / consultant
57
+
58
+ - **[JTBD-202 Run Pre-Flight Governance Checks Before Release or Handover](../../docs/jtbd/tech-lead/JTBD-202-pre-flight-governance-check.proposed.md)** — style-guide alignment is reviewable on demand before a release or client handover.
59
+
60
+ ### Plugin user
61
+
62
+ - **[JTBD-302 Trust That the README Describes the Plugin I Just Installed](../../docs/jtbd/plugin-user/JTBD-302-trust-readme-describes-installed-behaviour.proposed.md)** — this README is anchored on current JTBD job IDs; drift between prose and shipped behaviour is detectable at retro time per ADR-051.
63
+
48
64
  ## Updating and Uninstalling
49
65
 
50
66
  ```bash
@@ -45,6 +45,18 @@ case "$FILE_PATH" in
45
45
  ;;
46
46
  esac
47
47
 
48
+ # Governance-managed surface exemptions — ADR-060 § Phase 2 amendment
49
+ # 2026-05-12 lines 481-496 (P170 Phase 2 Slice 2.5). Mirrors the
50
+ # docs/problems / docs/jtbd peer-plugin policy exemptions in
51
+ # architect-enforce-edit.sh + jtbd-enforce-edit.sh. Short-circuits before
52
+ # the *.html extension check below would otherwise fire on story-map HTML.
53
+ case "$FILE_PATH" in
54
+ */docs/story-maps/*|docs/story-maps/*)
55
+ exit 0 ;;
56
+ */docs/stories/*|docs/stories/*)
57
+ exit 0 ;;
58
+ esac
59
+
48
60
  # Gate all UI source files (CSS and component files)
49
61
  case "$FILE_PATH" in
50
62
  *.css|*.html|*.jsx|*.tsx|*.vue|*.svelte|*.ejs|*.hbs) ;;
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env bats
2
+
3
+ # Tests for style-guide-enforce-edit.sh — verifies the path-based exemption
4
+ # for governance-managed surfaces (docs/story-maps/, docs/stories/) per
5
+ # ADR-060 § Phase 2 amendment 2026-05-12 lines 481-496 (P170 Phase 2 Slice 2.5).
6
+ #
7
+ # The style-guide hook is opt-in (gates only *.css|*.html|*.jsx|*.tsx|*.vue|
8
+ # *.svelte|*.ejs|*.hbs). Story-map HTML files would otherwise be blocked at
9
+ # `*.html` matching when docs/STYLE-GUIDE.md is absent OR review-gate is open.
10
+ # The exemption short-circuits before the extension check.
11
+
12
+ setup() {
13
+ SCRIPT_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
14
+ HOOK="$SCRIPT_DIR/style-guide-enforce-edit.sh"
15
+ ORIG_DIR="$PWD"
16
+ TEST_DIR=$(mktemp -d)
17
+ cd "$TEST_DIR"
18
+ }
19
+
20
+ teardown() {
21
+ cd "$ORIG_DIR"
22
+ rm -rf "$TEST_DIR"
23
+ }
24
+
25
+ run_hook_with_file() {
26
+ local file_path="$1"
27
+ local json="{\"tool_input\":{\"file_path\":\"${file_path}\"},\"session_id\":\"test-session-$$\"}"
28
+ echo "$json" | bash "$HOOK"
29
+ }
30
+
31
+ assert_path_allowed() {
32
+ local file_path="$1"
33
+ run run_hook_with_file "$file_path"
34
+ [ "$status" -eq 0 ]
35
+ [[ "$output" != *"BLOCKED"* ]]
36
+ }
37
+
38
+ assert_path_blocked() {
39
+ local file_path="$1"
40
+ run run_hook_with_file "$file_path"
41
+ [ "$status" -eq 0 ]
42
+ [[ "$output" == *"BLOCKED"* ]]
43
+ }
44
+
45
+ # --- Story maps + stories exemptions (P170 Phase 2 Slice 2.5 / ADR-060) ---
46
+
47
+ @test "style-guide: exempts docs/story-maps/ HTML in per-state subdir" {
48
+ assert_path_allowed "$PWD/docs/story-maps/draft/STORY-MAP-001-foo.html"
49
+ }
50
+
51
+ @test "style-guide: exempts docs/story-maps/ HTML in completed subdir" {
52
+ assert_path_allowed "$PWD/docs/story-maps/completed/STORY-MAP-002-bar.html"
53
+ }
54
+
55
+ @test "style-guide: exempts docs/stories/ files even though .md isn't normally gated" {
56
+ # Markdown isn't in the opt-in extension list anyway, so this passes by
57
+ # virtue of the extension filter — but the explicit exemption documents
58
+ # intent and survives a hypothetical future scope-widening.
59
+ assert_path_allowed "$PWD/docs/stories/draft/STORY-001-foo.md"
60
+ }
61
+
62
+ # --- Regression: non-exempt UI files still gate ---
63
+
64
+ @test "style-guide: still blocks an unrelated .html file when no policy exists" {
65
+ # No docs/STYLE-GUIDE.md created — hook should still block this HTML.
66
+ assert_path_blocked "$PWD/public/index.html"
67
+ }
68
+
69
+ @test "style-guide: still blocks a .tsx component file when no policy exists" {
70
+ assert_path_blocked "$PWD/src/Component.tsx"
71
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windyroad/style-guide",
3
- "version": "0.3.1",
3
+ "version": "0.4.0-preview.303",
4
4
  "description": "Style guide enforcement for CSS and UI components",
5
5
  "bin": {
6
6
  "windyroad-style-guide": "./bin/install.mjs"