@davesheffer/hunch 1.3.0 → 1.3.1

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 (2) hide show
  1. package/README.md +18 -14
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -7,30 +7,34 @@
7
7
  [![node](https://img.shields.io/badge/node-%E2%89%A522.13-2742ff)](https://nodejs.org)
8
8
  [![MCP](https://img.shields.io/badge/MCP-native-2742ff)](https://modelcontextprotocol.io)
9
9
 
10
- > **A linter checks whether code matches a *pattern*. Hunch checks whether code still matches your *architecture***
11
- > and blocks the AI change that breaks it, citing the decision and the past bug it would reopen.
12
- > The semantic invariants pattern-SAST can't express (layering, must-reach, dependency direction),
13
- > enforced deterministically over a **git-native** graph of *why* across any MCP assistant.
10
+ > **Your repo remembers *what* changed. Hunch makes it remember *why*** the decisions, the
11
+ > trade-offs, the bugs you already paid for and keeps every AI coding session consistent with them.
12
+ > When a change would quietly undo something you decided on purpose, Hunch notices and shows the
13
+ > receipt: which decision, and which past bug it protects you from. A linter checks *patterns*;
14
+ > Hunch understands your *architecture* (layering, must-reach, dependency direction) — deterministically,
15
+ > from a **git-native** graph, across any MCP assistant.
14
16
 
15
17
  ```bash
16
18
  npm i -g @davesheffer/hunch
17
- cd your-repo && hunch init
19
+ cd your-repo && hunch init # 2 minutes; advisory by default — nothing blocks until you say so
18
20
 
19
- # record an architectural invariant the kind Semgrep/SonarQube structurally can't express
21
+ # teach it one architectural rule, in plain words with the why
20
22
  hunch conform --add "controllers never reach the DB directly — go through the service layer" \
21
- --assert not-calls --subject listOrders --object dbQuery --why "the Mar-2025 N+1 meltdown"
23
+ --assert not-calls --subject listOrders --object dbQuery --why "the Mar-2025 N+1 incident"
22
24
 
23
- hunch conform --strict # ✅/⛔ deterministic gatewire into CI; runs on every AI change
25
+ hunch conform # deterministic checkand when you're ready, --strict wires it into CI
24
26
  ```
25
27
 
26
- > An AI "optimizes" the controller to query the DB directly. **Semgrep: green. SonarQube: green.**
27
- > (it's a legitimate internal import no bad pattern.) **Hunch: ⛔ BLOCKED** — *"listOrders now reaches
28
- > dbQuery VIOLATED · why: the Mar-2025 N+1 meltdown · prevents recurrence of bug_0317."* See
28
+ > Here's the moment it earns its keep: an AI "optimizes" your controller to query the DB directly.
29
+ > Pattern tools stay **green** — it's a legitimate internal import, no bad pattern to match.
30
+ > Hunch quietly flags it: *"listOrders now reaches dbQuery · why this matters: the Mar-2025 N+1
31
+ > incident · protects against a repeat of bug_0317."* You decide what happens next — advisory
32
+ > shows the note, **strict** (opt-in) holds the change. Watch the whole loop in 15 seconds:
29
33
  > [`demo/architectural-conformance.sh`](demo/architectural-conformance.sh).
30
34
 
31
- **It works both ways prevent *and* catch and you need both:**
32
- - **Prevent** — in a reproducible benchmark ([`bench/`](bench/architectural-conformance.md): n=90, Haiku/Sonnet/Opus, 3 invariant classes), the recorded invariant in context cut architectural violations **58% → 16%** overall (Sonnet **67% → 0%**). But prevention is *necessary, not sufficient*: **even Opus ignored a layering rule 60% of the time when told.** Each violation passes a linter clean.
33
- - **Catch** — which is exactly why the deterministic gate exists. `hunch check --strict` (the pre-commit hook + the [`hunch ci`](https://hunch-pi.vercel.app/docs#ci) PR gate) **blocks** what the model ignores with the receipt, **no model in the gate**. Injection helps; the gate is the guarantee.
35
+ **It helps twicebefore the change, and after:**
36
+ - **Before** — the recorded rule rides into the AI's context. In a reproducible benchmark ([`bench/`](bench/architectural-conformance.md): n=90, three models, 3 invariant classes), that alone cut architectural drift **58% → 16%** (one model: **67% → 0%**).
37
+ - **After** — reminders help, but models still drift even when told (the same benchmark measured it). So a deterministic check — [`hunch check`](https://hunch-pi.vercel.app/docs#ci) on commit or in your PR gate catches what reminders miss, always with the receipt, **no model in the loop**. Advisory first; you choose the [firmness](https://hunch-pi.vercel.app/docs#firmness).
34
38
 
35
39
  <sub>Works with **Claude Code, Cursor, Copilot, Windsurf & Google Antigravity** from one shared, git-native graph.</sub>
36
40
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@davesheffer/hunch",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Dave Sheffer <dave.sheffer1@gmail.com>",
6
6
  "description": "Architectural Conformance for AI-generated code: a git-native graph that deterministically blocks AI changes which break your architecture — the semantic invariants (layering, must-reach, dependency direction) pattern-SAST can't express — grounded in the decisions and bugs behind each rule, across any MCP assistant (Claude Code, Cursor, Copilot, Windsurf, Codex).",