qualia-framework 4.0.0 → 4.0.3

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.
Files changed (45) hide show
  1. package/CLAUDE.md +23 -11
  2. package/agents/plan-checker.md +1 -1
  3. package/bin/cli.js +18 -13
  4. package/bin/install.js +34 -45
  5. package/bin/qualia-ui.js +2 -2
  6. package/bin/state.js +74 -7
  7. package/bin/statusline.js +4 -1
  8. package/docs/erp-contract.md +12 -0
  9. package/guide.md +1 -1
  10. package/hooks/migration-guard.js +23 -9
  11. package/hooks/pre-compact.js +39 -11
  12. package/hooks/pre-deploy-gate.js +3 -4
  13. package/hooks/pre-push.js +6 -3
  14. package/hooks/session-start.js +8 -8
  15. package/package.json +1 -1
  16. package/rules/frontend.md +5 -13
  17. package/skills/qualia/SKILL.md +5 -0
  18. package/skills/qualia-build/SKILL.md +10 -0
  19. package/skills/qualia-debug/SKILL.md +6 -0
  20. package/skills/qualia-design/SKILL.md +9 -1
  21. package/skills/qualia-discuss/SKILL.md +6 -0
  22. package/skills/qualia-handoff/SKILL.md +5 -0
  23. package/skills/qualia-help/SKILL.md +18 -4
  24. package/skills/qualia-idk/SKILL.md +6 -0
  25. package/skills/qualia-learn/SKILL.md +6 -0
  26. package/skills/qualia-map/SKILL.md +7 -0
  27. package/skills/qualia-milestone/SKILL.md +6 -0
  28. package/skills/qualia-new/SKILL.md +13 -1
  29. package/skills/qualia-optimize/SKILL.md +8 -0
  30. package/skills/qualia-pause/SKILL.md +5 -0
  31. package/skills/qualia-plan/SKILL.md +11 -1
  32. package/skills/qualia-polish/SKILL.md +8 -0
  33. package/skills/qualia-quick/SKILL.md +7 -0
  34. package/skills/qualia-report/SKILL.md +5 -0
  35. package/skills/qualia-research/SKILL.md +7 -0
  36. package/skills/qualia-resume/SKILL.md +3 -0
  37. package/skills/qualia-review/SKILL.md +7 -0
  38. package/skills/qualia-ship/SKILL.md +5 -0
  39. package/skills/qualia-skill-new/SKILL.md +6 -0
  40. package/skills/qualia-task/SKILL.md +8 -1
  41. package/skills/qualia-test/SKILL.md +7 -0
  42. package/skills/qualia-verify/SKILL.md +8 -0
  43. package/templates/help.html +4 -4
  44. package/tests/hooks.test.sh +5 -5
  45. package/tests/runner.js +212 -3
package/rules/frontend.md CHANGED
@@ -109,18 +109,10 @@ These are Qualia brand standards — mandatory for every frontend component. Not
109
109
  If `.planning/DESIGN.md` exists in the project, it takes precedence over these defaults.
110
110
  Read it before any frontend work. It contains project-specific: palette, typography, spacing, component patterns.
111
111
 
112
- ## Impeccable Design Skills (global)
113
- - `/polish` — Final detail pass before shipping
114
- - `/bolder` — Amplify safe/boring designs
115
- - `/design-quieter` — Tone down overly aggressive designs
116
- - `/animate` — Add purposeful micro-interactions
117
- - `/colorize` — Inject strategic color into monochrome UIs
118
- - `/clarify` — Fix unclear UX copy, labels, error messages
119
- - `/critique` — Design director-level review
120
- - `/distill` — Strip unnecessary complexity
121
- - `/delight` — Add memorable touches and personality
122
- - `/harden` — Edge cases, overflow, i18n robustness
123
- - `/responsive` — Cross-device responsive adaptation
112
+ ## Qualia design commands
113
+ - `/qualia-design` — One-shot design transformation (critique + fix + polish + responsive + harden)
114
+ - `/qualia-polish` — Final detail pass before shipping (run after all phases verified)
115
+ - `/qualia-review` — Scored production audit
124
116
 
125
117
  ### Recommended workflow
126
- 1. Build feature → 2. `/critique` → 3. `/polish` → 4. `/harden` → ship
118
+ 1. Build feature → 2. `/qualia-design` → 3. `/qualia-polish` → ship
@@ -1,6 +1,11 @@
1
1
  ---
2
2
  name: qualia
3
3
  description: "Smart router — reads project state (state.js), classifies the situation mechanically, returns the exact next command. Use whenever you type /qualia, 'what next', 'next', 'what now', 'what should I do next', 'what command now'. For deeper 'I don't understand what's going on' / 'something feels off' situations, use /qualia-idk instead — that one actually scans the planning folder and codebase to diagnose the confusion."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Grep
8
+ - Glob
4
9
  ---
5
10
 
6
11
  # /qualia — What's Next?
@@ -1,6 +1,16 @@
1
1
  ---
2
2
  name: qualia-build
3
3
  description: "Execute the current phase — spawns builder subagents per task with wave-based parallelization. Fresh context per task."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
11
+ - Agent
12
+ - TaskCreate
13
+ - TaskUpdate
4
14
  ---
5
15
 
6
16
  # /qualia-build — Build a Phase
@@ -1,6 +1,12 @@
1
1
  ---
2
2
  name: qualia-debug
3
3
  description: "Structured debugging — symptom gathering, diagnosis confirmation, root cause analysis. Trigger on 'debug', 'find bug', 'fix error', 'something is broken', 'not working', 'weird behavior', 'layout broken', 'CSS issue', 'slow page', 'performance'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Grep
8
+ - Glob
9
+ - Agent
4
10
  ---
5
11
 
6
12
  # /qualia-debug — Structured Debugging
@@ -1,6 +1,14 @@
1
1
  ---
2
2
  name: qualia-design
3
3
  description: "One-shot design transformation — critiques, fixes, polishes, hardens, makes responsive. No reports, no choices, just makes it professional. Trigger on 'fix the design', 'make it look better', 'redesign', 'design pass', 'make it modern', 'it looks ugly', 'fix the UI'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
11
+ - Agent
4
12
  ---
5
13
 
6
14
  # /qualia-design — One-Shot Design Transformation
@@ -87,7 +95,7 @@ git commit -m "style: design transformation"
87
95
  - {key change 2}
88
96
  - {key change 3}
89
97
 
90
- Fine-tune: /bolder, /design-quieter, /colorize, /animate
98
+ Next: /qualia-polish (final pass) · /qualia-review (scored audit)
91
99
  ```
92
100
 
93
101
  ## Rules
@@ -1,6 +1,12 @@
1
1
  ---
2
2
  name: qualia-discuss
3
3
  description: "Capture phase decisions, trade-offs, and constraints BEFORE planning. Use for complex phases with regulatory, compliance, or architectural stakes. Creates .planning/phase-{N}-context.md that planner honors as locked input."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - AskUserQuestion
4
10
  ---
5
11
 
6
12
  # /qualia-discuss — Phase Context Capture
@@ -1,6 +1,11 @@
1
1
  ---
2
2
  name: qualia-handoff
3
3
  description: "Client delivery — produces the 4 mandatory Handoff deliverables (production URL, documentation, client assets archive, ERP finalization). Triggered at the end of the Handoff milestone."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
4
9
  ---
5
10
 
6
11
  # /qualia-handoff — Client Delivery
@@ -1,6 +1,9 @@
1
1
  ---
2
2
  name: qualia-help
3
3
  description: "Open the Qualia Framework reference guide in the browser. A beautiful themed HTML page with all commands, rules, services, and the road. Trigger on 'help', 'how does this work', 'show me the commands', 'qualia help', 'reference'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
4
7
  ---
5
8
 
6
9
  # /qualia-help — Framework Reference
@@ -12,14 +15,25 @@ Opens a Qualia-themed HTML reference guide in your default browser.
12
15
  ### 1. Generate the HTML
13
16
 
14
17
  ```bash
15
- # Read the template and inject the current version
16
- VERSION=$(node -e "console.log(require(require('os').homedir() + '/.claude/.qualia-config.json').version || 'v3')" 2>/dev/null || echo "v3")
18
+ # Read the template and inject the current version.
19
+ # Prefer .qualia-config.json; fall back to the framework package.json; last resort is the
20
+ # literal string "latest" so the UI never lies about a specific version.
21
+ VERSION=$(node -e "
22
+ const fs = require('fs'), path = require('path'), os = require('os');
23
+ const cfg = path.join(os.homedir(), '.claude', '.qualia-config.json');
24
+ const pkg = path.join(os.homedir(), '.claude', 'qualia-framework', 'package.json');
25
+ try { const v = JSON.parse(fs.readFileSync(cfg,'utf8')).version; if (v) { console.log(v); process.exit(0); } } catch {}
26
+ try { const v = JSON.parse(fs.readFileSync(pkg,'utf8')).version; if (v) { console.log('v'+v); process.exit(0); } } catch {}
27
+ console.log('latest');
28
+ " 2>/dev/null || echo "latest")
17
29
  TEMPLATE="$HOME/.claude/qualia-templates/help.html"
18
30
  OUTPUT="/tmp/qualia-help.html"
19
31
 
20
- # If template doesn't exist, check the framework install
32
+ # If template doesn't exist in the user home, check the installed framework copy.
21
33
  if [ ! -f "$TEMPLATE" ]; then
22
- TEMPLATE="$(dirname "$(dirname "$(which qualia-framework 2>/dev/null || echo '')")")/templates/help.html"
34
+ for CANDIDATE in "$HOME/.claude/qualia-framework/templates/help.html"; do
35
+ if [ -f "$CANDIDATE" ]; then TEMPLATE="$CANDIDATE"; break; fi
36
+ done
23
37
  fi
24
38
  ```
25
39
 
@@ -1,6 +1,12 @@
1
1
  ---
2
2
  name: qualia-idk
3
3
  description: "Diagnostic intelligence for 'I don't know what's going on.' Runs two isolated scans (.planning/ vs codebase), cross-references against the user's confusion, then explains the situation in plain language with a concrete recommended next step. Use whenever the user says 'I don't know', 'something feels off', 'not sure what to do', 'am I doing this right', 'what's happening', 'help me understand'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Grep
8
+ - Glob
9
+ - Agent
4
10
  ---
5
11
 
6
12
  # /qualia-idk — "I Don't Know What's Going On"
@@ -1,6 +1,12 @@
1
1
  ---
2
2
  name: qualia-learn
3
3
  description: "Save a learning, pattern, fix, or client preference to the knowledge base. Persists across projects and sessions. Trigger on 'remember this', 'save this pattern', 'learned something', 'note for future', 'client prefers', 'qualia-learn'."
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Edit
8
+ - Glob
9
+ - Grep
4
10
  ---
5
11
 
6
12
  # /qualia-learn — Save Knowledge
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  name: qualia-map
3
3
  description: "Map an existing codebase to infer architecture, stack, conventions, and what's already built. For brownfield projects — run BEFORE /qualia-new so Validated requirements get inferred from existing code."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Grep
9
+ - Glob
10
+ - Agent
4
11
  ---
5
12
 
6
13
  # /qualia-map — Codebase Mapping (Brownfield)
@@ -1,6 +1,12 @@
1
1
  ---
2
2
  name: qualia-milestone
3
3
  description: "Close the current milestone and open the next one — loads the next milestone's scope from JOURNEY.md (no ad-hoc naming). Archives artifacts, marks requirements Complete, regenerates ROADMAP.md for the next milestone."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Agent
4
10
  ---
5
11
 
6
12
  # /qualia-milestone — Milestone Closeout
@@ -1,6 +1,18 @@
1
1
  ---
2
2
  name: qualia-new
3
3
  description: "Set up a new project from scratch — deep questioning, ALWAYS-AUTO research, JOURNEY.md with all milestones to handoff, single approval gate, optional auto-chain into building. Use when starting any new client project."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
11
+ - Agent
12
+ - AskUserQuestion
13
+ - TaskCreate
14
+ - TaskUpdate
15
+ - TaskList
4
16
  ---
5
17
 
6
18
  # /qualia-new — New Project (Full Journey)
@@ -204,7 +216,7 @@ Display top 3 from SUMMARY.md (stack recommendation, table stakes, top pitfall).
204
216
 
205
217
  ### Step 9. Feature Scoping (Multi-Milestone)
206
218
 
207
- Read `.planning/research/FEATURES.md` and present the feature landscape. Unlike v3, features are scoped **to milestones**, not just to v1/v2.
219
+ Read `.planning/research/FEATURES.md` and present the feature landscape. Features are scoped **to milestones** you'll decide per-feature which milestone owns it.
208
220
 
209
221
  For each category, use AskUserQuestion:
210
222
 
@@ -1,6 +1,14 @@
1
1
  ---
2
2
  name: qualia-optimize
3
3
  description: "Deep optimization pass — reads .planning/ AND codebase to find performance, design, UI, backend, and frontend issues. Spawns parallel specialist agents. Use this skill whenever the user says 'optimize', 'optimization pass', 'find issues', 'qualia-optimize', 'deep optimize', 'performance audit', 'design alignment check', 'speed up', 'slow', 'bundle size', or wants a comprehensive quality sweep. Supports --perf, --ui, --backend, --alignment, --fix flags."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
11
+ - Agent
4
12
  ---
5
13
 
6
14
  # Qualia Optimize — Deep Codebase + Planning Optimization
@@ -1,6 +1,11 @@
1
1
  ---
2
2
  name: qualia-pause
3
3
  description: "Save session context for seamless handoff. Creates .continue-here.md so the next session picks up exactly where you left off. Trigger on 'pause', 'stop for now', 'save progress', 'continue later', 'pick up tomorrow'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
4
9
  ---
5
10
 
6
11
  # /qualia-pause — Session Handoff
@@ -1,6 +1,16 @@
1
1
  ---
2
2
  name: qualia-plan
3
3
  description: "Plan the current phase — spawns planner, validates with plan-checker in a revision loop (max 3), optionally runs discuss/research first. Use when ready to plan a phase."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
11
+ - Agent
12
+ - TaskCreate
13
+ - TaskUpdate
4
14
  ---
5
15
 
6
16
  # /qualia-plan — Plan a Phase
@@ -196,7 +206,7 @@ When invoked as `/qualia-plan {N} --gaps`, the planner is in gap-closure mode:
196
206
  2. For each FAIL item, create a targeted fix task:
197
207
  - **Files:** specific files that failed verification
198
208
  - **Action:** specific fix (not "fix auth" — "add session persistence check in src/lib/auth.ts signIn function")
199
- - **Done when:** the exact verification criterion that previously failed, restated
209
+ - **Acceptance Criteria:** the exact verification criterion that previously failed, restated as an observable behavior
200
210
  3. Do NOT re-plan passing items. Do NOT add new features. Gap plans are surgical.
201
211
  4. Write to `.planning/phase-{N}-gaps-plan.md` (separate from original plan)
202
212
  5. All gap tasks are Wave 1 (parallel) unless they share files
@@ -1,6 +1,14 @@
1
1
  ---
2
2
  name: qualia-polish
3
3
  description: "Design and UX pass — anti-AI-slop, genuine craft, responsive, accessible. Run after all phases are verified."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
11
+ - Agent
4
12
  ---
5
13
 
6
14
  # /qualia-polish — Design Pass
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  name: qualia-quick
3
3
  description: "Fast path for small tasks — bug fixes, tweaks, hot fixes. Skips full phase planning. Trigger on 'quick fix', 'small change', 'tweak', 'hot fix', 'one-line fix', 'quick edit', 'small bug'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
4
11
  ---
5
12
 
6
13
  # /qualia-quick — Quick Task
@@ -1,6 +1,11 @@
1
1
  ---
2
2
  name: qualia-report
3
3
  description: "Generate session report and commit to repo. Mandatory before clock-out."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
4
9
  ---
5
10
 
6
11
  # /qualia-report — Session Report
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  name: qualia-research
3
3
  description: "Deep-research a niche domain or library BEFORE planning a specific phase. Spawns the researcher agent with Context7/WebFetch access. Writes to .planning/phase-{N}-research.md."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Agent
9
+ - WebFetch
10
+ - WebSearch
4
11
  ---
5
12
 
6
13
  # /qualia-research — Per-Phase Deep Research
@@ -1,6 +1,9 @@
1
1
  ---
2
2
  name: qualia-resume
3
3
  description: "Restore context from a previous session. Reads .continue-here.md or STATE.md, summarizes where you left off, routes to next action. Trigger on 'resume', 'continue', 'pick up where I left off', 'what was I doing'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
4
7
  ---
5
8
 
6
9
  # /qualia-resume — Resume Work
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  name: qualia-review
3
3
  description: "Production audit with scored diagnostics. Runs real commands, scores findings by severity. Trigger on 'review', 'audit', 'code review', 'security check', 'production check'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Grep
9
+ - Glob
10
+ - Agent
4
11
  ---
5
12
 
6
13
  # /qualia-review — Production Audit
@@ -1,6 +1,11 @@
1
1
  ---
2
2
  name: qualia-ship
3
3
  description: "Deploy to production — quality gates, commit, push, deploy, verify. Use when ready to go live."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
4
9
  ---
5
10
 
6
11
  # /qualia-ship — Deploy
@@ -1,6 +1,12 @@
1
1
  ---
2
2
  name: qualia-skill-new
3
3
  description: "Author a new Qualia skill or agent. Use when the user says 'create a new skill', 'add a skill', 'I want to build a skill', 'make this a reusable command', 'turn this into a skill'. Generates the SKILL.md, registers it in the right location, and optionally ships to the framework repo."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - AskUserQuestion
4
10
  ---
5
11
 
6
12
  # /qualia-skill-new — Author a New Skill
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  name: qualia-task
3
3
  description: "Build a single task — more structured than /qualia-quick, lighter than /qualia-build. Spawns a fresh builder agent for one focused task."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Agent
10
+ - AskUserQuestion
4
11
  ---
5
12
 
6
13
  # /qualia-task — Single Task Builder
@@ -61,7 +68,7 @@ Agent(subagent_type: "qualia-builder")
61
68
 
62
69
  Task: {task description}
63
70
  Files: {files to create/modify}
64
- Done when: {completion criteria}
71
+ Acceptance Criteria: {observable completion criteria, 1-3 bullet points}
65
72
 
66
73
  Context: Read PROJECT.md if it exists. Follow all rules (security, frontend, deployment).
67
74
  ```
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  name: qualia-test
3
3
  description: "Generate or run tests for client projects. Trigger on 'write tests', 'add tests', 'test this', 'run tests', 'test coverage', 'need tests for'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
4
11
  ---
5
12
 
6
13
  # /qualia-test — Test Generator
@@ -1,6 +1,14 @@
1
1
  ---
2
2
  name: qualia-verify
3
3
  description: "Goal-backward verification — checks if the phase ACTUALLY works, not just if tasks completed. Spawns verifier agent."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
11
+ - Agent
4
12
  ---
5
13
 
6
14
  # /qualia-verify — Verify a Phase
@@ -291,13 +291,13 @@
291
291
  </head>
292
292
  <body>
293
293
 
294
- <div class="version-pill">v3.6.0</div>
294
+ <div class="version-pill">{{VERSION}}</div>
295
295
 
296
296
  <div class="header">
297
297
  <div class="header-content">
298
298
  <h1><span>Qualia</span> Framework</h1>
299
299
  <p>Plan, build, verify, ship. The AI-powered workflow for Qualia Solutions.</p>
300
- <div class="version">v3.6.0 &middot; 26 skills</div>
300
+ <div class="version">{{VERSION}} &middot; 26 skills</div>
301
301
  </div>
302
302
  </div>
303
303
 
@@ -430,7 +430,7 @@
430
430
  <div class="cmd"><span class="cmd-name">qualia-framework install</span><span class="cmd-desc">Install or reinstall the framework.</span></div>
431
431
  <div class="cmd"><span class="cmd-name">qualia-framework update</span><span class="cmd-desc">Update to the latest version.</span></div>
432
432
  <div class="cmd"><span class="cmd-name">qualia-framework version</span><span class="cmd-desc">Show installed version + check for updates.</span></div>
433
- <div class="cmd"><span class="cmd-name">qualia-framework migrate</span><span class="cmd-desc">Upgrade v2 settings to v3.</span></div>
433
+ <div class="cmd"><span class="cmd-name">qualia-framework migrate</span><span class="cmd-desc">Upgrade legacy settings.json to the current hook layout.</span></div>
434
434
  <div class="cmd"><span class="cmd-name">qualia-framework analytics</span><span class="cmd-desc">Hook telemetry, verification pass rates, gap cycles.</span></div>
435
435
  <div class="cmd"><span class="cmd-name">qualia-framework team</span><span class="cmd-desc">List, add, or remove team members.</span></div>
436
436
  <div class="cmd"><span class="cmd-name">qualia-framework traces</span><span class="cmd-desc">View recent hook activity.</span></div>
@@ -536,7 +536,7 @@
536
536
  <div class="footer">
537
537
  <strong>Welcome to the future with Qualia.</strong><br>
538
538
  Qualia Solutions &mdash; Nicosia, Cyprus
539
- <span class="footer-version">qualia-framework v3.6.0 &middot; 26 skills</span>
539
+ <span class="footer-version">qualia-framework {{VERSION}} &middot; 26 skills</span>
540
540
  </div>
541
541
 
542
542
  </body>
@@ -218,25 +218,25 @@ export default function P(){return null}
218
218
  EOF
219
219
  OUT=$(cd "$TMP" && $NODE "$HOOKS_DIR/pre-deploy-gate.js" 2>&1)
220
220
  RC=$?
221
- if [ "$RC" -eq 1 ] \
221
+ if [ "$RC" -eq 2 ] \
222
222
  && echo "$OUT" | grep -q "BLOCKED" \
223
223
  && echo "$OUT" | grep -q "service_role"; then
224
- echo " ✓ service_role leak in app/ → blocked with diagnostic"
224
+ echo " ✓ service_role leak in app/ → blocked with diagnostic (exit 2)"
225
225
  PASS=$((PASS + 1))
226
226
  else
227
- echo " ✗ service_role leak in app/ → blocked (exit=$RC)"
227
+ echo " ✗ service_role leak in app/ → blocked (exit=$RC, expected 2)"
228
228
  FAIL=$((FAIL + 1))
229
229
  fi
230
230
  rm -rf "$TMP"
231
231
 
232
- # service_role leak in components/ → BLOCKED
232
+ # service_role leak in components/ → BLOCKED (exit 2 per PreToolUse contract)
233
233
  TMP=$(mktemp -d)
234
234
  mkdir -p "$TMP/components"
235
235
  cat > "$TMP/components/Widget.tsx" <<'EOF'
236
236
  const key = "service_role_literal_leak";
237
237
  EOF
238
238
  (cd "$TMP" && $NODE "$HOOKS_DIR/pre-deploy-gate.js" >/dev/null 2>&1)
239
- assert_exit "service_role in components/ → blocked" 1 $?
239
+ assert_exit "service_role in components/ → blocked (exit 2)" 2 $?
240
240
  rm -rf "$TMP"
241
241
 
242
242
  # service_role in a *.server.ts file → allowed (skip convention)