@windyroad/jtbd 0.5.1 → 0.5.2

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-jtbd",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Jobs-to-be-done enforcement for Claude Code"
5
- }
5
+ }
package/agents/agent.md CHANGED
@@ -45,6 +45,10 @@ All review criteria come from the JTBD documentation. Read the docs first and ap
45
45
  - If the change involves API interactions, do the actions align with the job's expected flow?
46
46
  - Are new actions documented in the relevant job's action list?
47
47
 
48
+ ## Output Formatting
49
+
50
+ When referencing JTBD IDs, problem IDs (P<NNN>), or ADR IDs in prose output, always include the human-readable title on first mention. Use the format `JTBD-001 (Enforce Governance Without Slowing Down)`, not bare `JTBD-001`.
51
+
48
52
  ## How to Report
49
53
 
50
54
  If the change aligns with documented jobs:
@@ -82,12 +86,28 @@ If the code serves a user type not described by the existing persona:
82
86
 
83
87
  These are FAIL verdicts — the JTBD documentation must be updated before the code can proceed.
84
88
 
85
- ## Verdict
89
+ ## Output Contract (P037)
90
+
91
+ Your response has two communication channels. Both are required; neither replaces the other.
92
+
93
+ **1. Inline response (primary, user-facing, REQUIRED in every response):**
94
+
95
+ Every response MUST begin with one of the four verdict templates from "How to Report" above — `JTBD Review: PASS`, `JTBD Review: ISSUES FOUND`, `JTBD Review: JOB UPDATE NEEDED`, or `JTBD Review: PERSONA UPDATE NEEDED`. The inline verdict is the authoritative primary channel — it is what the caller reads and acts on.
96
+
97
+ - On **PASS**: include the aligned job ID, a brief alignment summary, and the persona-fit confirmation (which constraints were checked).
98
+ - On **ISSUES FOUND / JOB UPDATE NEEDED / PERSONA UPDATE NEEDED**: include actionable remediation guidance — the specific file + line, the issue, the affected job (or "no matching job"), and the fix (what would need to change for the review to pass).
99
+
100
+ You MUST NOT emit a bare verdict without body. "FAIL" alone, "ISSUES FOUND" alone, or a list of reviewed files without a verdict line are all forbidden output shapes. If there are no issues, emit PASS with alignment summary; if there are issues, emit ISSUES FOUND with at least one concrete remediation item. Every response must contain enough inline detail that the caller can act without a re-query.
101
+
102
+ **2. Verdict marker file (internal signal, REQUIRED to coordinate with hooks):**
103
+
104
+ After emitting your inline response, write your verdict to `/tmp/jtbd-verdict`. This file is consumed by the `jtbd-mark-reviewed.sh` PostToolUse hook to gate subsequent edits. It is NOT a substitute for the inline response:
86
105
 
87
- After completing your review, write your verdict to `/tmp/jtbd-verdict`:
88
106
  - `printf 'PASS' > /tmp/jtbd-verdict` — change aligns with documented jobs and persona
89
107
  - `printf 'FAIL' > /tmp/jtbd-verdict` — misalignment, job gap, or persona gap detected
90
108
 
109
+ The inline verdict and the marker file MUST agree. If inline says PASS, the file says PASS; if inline says ISSUES FOUND / JOB UPDATE NEEDED / PERSONA UPDATE NEEDED, the file says FAIL.
110
+
91
111
  ## Constraints
92
112
 
93
113
  - You are read-only. You do not edit files (except writing the verdict file).
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env bats
2
+ # Doc-lint guard: jtbd agent.md must include the output formatting rule
3
+ # requiring human-readable titles alongside bare IDs (P032).
4
+ #
5
+ # Structural assertion — Permitted Exception to the source-grep ban (ADR-005 / P011).
6
+ #
7
+ # Cross-reference:
8
+ # P032 (agent output uses opaque IDs without titles)
9
+ # @jtbd JTBD-001 (enforce governance without slowing down)
10
+
11
+ setup() {
12
+ AGENT_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
13
+ AGENT_FILE="${AGENT_DIR}/agent.md"
14
+ }
15
+
16
+ @test "agent.md contains output formatting section" {
17
+ run grep -n "## Output Formatting" "$AGENT_FILE"
18
+ [ "$status" -eq 0 ]
19
+ }
20
+
21
+ @test "agent.md output formatting rule requires titles with IDs (P032)" {
22
+ run grep -n "title" "$AGENT_FILE"
23
+ [ "$status" -eq 0 ]
24
+ run grep -n "Output Formatting" "$AGENT_FILE"
25
+ [ "$status" -eq 0 ]
26
+ }
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env bats
2
+ # Doc-lint guard: wr-jtbd:agent output contract — the agent MUST emit a
3
+ # structured inline verdict in every response, regardless of the
4
+ # /tmp/jtbd-verdict file write. Closes P037 (JTBD reviewer sometimes
5
+ # returns a bare verdict without remediation reason).
6
+ #
7
+ # Structural assertion — Permitted Exception to the source-grep ban
8
+ # (ADR-005 / P011).
9
+ #
10
+ # Cross-reference:
11
+ # P037 (JTBD reviewer bare-verdict bug)
12
+ # @jtbd JTBD-001 (enforce governance without slowing down)
13
+
14
+ setup() {
15
+ AGENT_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
16
+ AGENT_FILE="${AGENT_DIR}/agent.md"
17
+ }
18
+
19
+ @test "agent.md contains inline verdict templates (How to Report section)" {
20
+ run grep -n "How to Report" "$AGENT_FILE"
21
+ [ "$status" -eq 0 ]
22
+ }
23
+
24
+ @test "agent.md declares inline output is REQUIRED in every response (P037)" {
25
+ # Must say inline output is required / must be emitted every time.
26
+ run grep -niE "(always|every|must|required).*inline|inline.*(always|every|must|required)" "$AGENT_FILE"
27
+ [ "$status" -eq 0 ]
28
+ }
29
+
30
+ @test "agent.md declares the primary communication channel is inline, not the file (P037)" {
31
+ # Must clarify the verdict file is an internal signal, not a replacement for inline output
32
+ run grep -niE "(primary|authoritative).*(inline|user-facing|response)|inline.*(primary|authoritative)" "$AGENT_FILE"
33
+ [ "$status" -eq 0 ]
34
+ }
35
+
36
+ @test "agent.md requires a specific verdict line on every response (PASS or ISSUES FOUND)" {
37
+ # The verdict line is explicit - bold JTBD Review: PASS / ISSUES FOUND
38
+ run grep -nE "JTBD Review: (PASS|ISSUES FOUND|JOB UPDATE NEEDED|PERSONA UPDATE NEEDED)" "$AGENT_FILE"
39
+ [ "$status" -eq 0 ]
40
+ }
41
+
42
+ @test "agent.md requires remediation guidance on every FAIL verdict (P037)" {
43
+ # On ISSUES FOUND the agent must include actionable guidance (what to change / what job / what fix)
44
+ run grep -niE "remediation|actionable|what (should|would need)|fix:|issue:" "$AGENT_FILE"
45
+ [ "$status" -eq 0 ]
46
+ }
47
+
48
+ @test "agent.md cross-references P037 so readers can trace the contract's origin" {
49
+ run grep -n "P037" "$AGENT_FILE"
50
+ [ "$status" -eq 0 ]
51
+ }
52
+
53
+ @test "agent.md explicitly forbids bare verdict without reason (P037)" {
54
+ # Directly addresses the observed bug: verdict without body
55
+ run grep -niE "(must not|MUST NOT|do not|DO NOT|never) (emit|return|produce) (a )?bare|without (reason|remediation|detail|actionable|explanation)" "$AGENT_FILE"
56
+ [ "$status" -eq 0 ]
57
+ }
@@ -22,7 +22,10 @@ REQUIRED ACTIONS:
22
22
  4. Do NOT skip this step even if you think you can handle it yourself
23
23
 
24
24
  SCOPE: All project files.
25
- Does NOT apply to: CSS, images, fonts, lockfiles, changesets, memory files, plan files.
25
+ Does NOT apply to: CSS, images, fonts, lockfiles, changesets, memory files,
26
+ plan files, docs/problems/ (problem tickets), docs/BRIEFING.md,
27
+ RISK-POLICY.md, .risk-reports/, docs/jtbd/, docs/JOBS_TO_BE_DONE.md,
28
+ docs/PRODUCT_DISCOVERY.md, docs/VOICE-AND-TONE.md, docs/STYLE-GUIDE.md.
26
29
  HOOK_OUTPUT
27
30
  elif [ -f "docs/JOBS_TO_BE_DONE.md" ]; then
28
31
  cat <<'HOOK_OUTPUT'
@@ -42,7 +45,10 @@ REQUIRED ACTIONS:
42
45
  4. Do NOT skip this step even if you think you can handle it yourself
43
46
 
44
47
  SCOPE: All project files.
45
- Does NOT apply to: CSS, images, fonts, lockfiles, changesets, memory files, plan files.
48
+ Does NOT apply to: CSS, images, fonts, lockfiles, changesets, memory files,
49
+ plan files, docs/problems/ (problem tickets), docs/BRIEFING.md,
50
+ RISK-POLICY.md, .risk-reports/, docs/jtbd/, docs/JOBS_TO_BE_DONE.md,
51
+ docs/PRODUCT_DISCOVERY.md, docs/VOICE-AND-TONE.md, docs/STYLE-GUIDE.md.
46
52
  HOOK_OUTPUT
47
53
  else
48
54
  cat <<'HOOK_OUTPUT'
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env bats
2
+
3
+ # Tests for jtbd-eval.sh (UserPromptSubmit) — verifies the injected scope
4
+ # exclusion text lists governance docs that the PreToolUse gate already
5
+ # exempts (P029). Without this, the LLM wastes time delegating to the
6
+ # jtbd-lead for files the edit gate would allow anyway.
7
+
8
+ setup() {
9
+ SCRIPT_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
10
+ HOOK="$SCRIPT_DIR/jtbd-eval.sh"
11
+ ORIG_DIR="$PWD"
12
+ TEST_DIR=$(mktemp -d)
13
+ cd "$TEST_DIR"
14
+ mkdir -p docs/jtbd
15
+ echo "# Index" > docs/jtbd/README.md
16
+ }
17
+
18
+ teardown() {
19
+ cd "$ORIG_DIR"
20
+ rm -rf "$TEST_DIR"
21
+ }
22
+
23
+ @test "eval: scope text mentions problem files exemption (P029)" {
24
+ run bash "$HOOK"
25
+ [ "$status" -eq 0 ]
26
+ [[ "$output" == *"docs/problems/"* ]] || [[ "$output" == *"problem tickets"* ]]
27
+ }
28
+
29
+ @test "eval: scope text mentions BRIEFING.md exemption (P029)" {
30
+ run bash "$HOOK"
31
+ [ "$status" -eq 0 ]
32
+ [[ "$output" == *"BRIEFING"* ]]
33
+ }
34
+
35
+ @test "eval: scope text mentions RISK-POLICY exemption (P029)" {
36
+ run bash "$HOOK"
37
+ [ "$status" -eq 0 ]
38
+ [[ "$output" == *"RISK-POLICY"* ]]
39
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windyroad/jtbd",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Jobs-to-be-done enforcement for UI changes",
5
5
  "bin": {
6
6
  "windyroad-jtbd": "./bin/install.mjs"
@@ -17,6 +17,10 @@ This skill is **read-only**. It does not commit, push, or modify files.
17
17
  - After a significant capability change: check whether existing jobs are still served
18
18
  - Any time the hook gate is not convenient: planning mode, spike work, design review
19
19
 
20
+ ## Output Formatting
21
+
22
+ When referencing JTBD IDs, problem IDs (P<NNN>), or ADR IDs in prose output, always include the human-readable title on first mention. Use the format `JTBD-001 (Enforce Governance Without Slowing Down)`, not bare `JTBD-001`.
23
+
20
24
  ## Steps
21
25
 
22
26
  ### 1. Parse arguments