Skip to content

v2.2.0 — Smart Enforcement

Choose a tag to compare

@j-morgan6 j-morgan6 released this 20 Mar 23:26

What's New

Hooks are now context-aware — they adapt to your project stack and include copy-pasteable fix suggestions instead of bare warnings.

New: Project Detection System

SessionStart hook runs detect_project.sh once per session, parsing mix.exs to detect:

  • Phoenix version (1.7 vs 1.8+ Scope struct)
  • LiveView presence (full-stack vs API-only)
  • Ecto adapter (Postgres, SQLite, MySQL)
  • Oban presence

Results cached to .elixir-phoenix-guide-project.json — all hooks read this to conditionally apply rules.

New: 4 PostToolUse Validation Hooks

Run after code is written, catching architectural issues:

Hook Behavior
missing-preload Warns on association accessors without visible preload
missing-error-clause Warns on with statements missing else clause
raw-sql-warning Blocks SQL injection (string interpolation in raw SQL), warns on all raw SQL
context-boundary-violation Warns on Repo calls in LiveView modules (skips in API-only projects)

Upgraded: Auto-Fix Suggestions

All warning hooks now include copy-pasteable fix examples:

```
⚠️ Nested if/else detected.

💡 Fix: Replace with case or multi-clause function:

 case {condition_a, condition_b} do
   {true, true} -> handle_both()
   {true, false} -> handle_a_only()
   _ -> handle_default()
 end

```

Upgraded hooks: nested-if-else, inefficient-enum, string-concatenation, missing-impl, hardcoded-paths, hardcoded-sizes.

Context-Aware Hooks

Hooks now adapt based on detected project stack:

  • API-only projects — LiveView hooks skip silently (missing-impl, auto-upload, context-boundary-violation)
  • Phoenix 1.8+ — Warns on @current_user usage (should use @current_scope)
  • Skill reminder — Notes API-only status when LiveView is absent

Component Counts

Component Count
Skills 14
Hooks 21 (1 SessionStart + 14 PreToolUse + 5 PostToolUse + 1 SubagentStart)
Scripts 4
Agent Docs 4

Updating

```bash
/plugin

Select "Marketplaces" → "elixir-phoenix-guide" → "Update"

```

Full Changelog: v2.1.0...v2.2.0