eslint-plugin-ai-guard 1.3.1 → 1.4.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.
package/README.md CHANGED
@@ -33,7 +33,14 @@
33
33
 
34
34
  ## What is AI Guard?
35
35
 
36
- **AI Guard** (`eslint-plugin-ai-guard`) is a deterministic ESLint plugin, CLI, and GitHub Action engineered to detect reliability bugs, async hazards, security vulnerabilities, and code-scaffolding defects frequently introduced during AI-assisted development (GitHub Copilot, Cursor, Claude Code, Gemini Code Assist, etc.).
36
+ **AI Guard** (`eslint-plugin-ai-guard`) provides:
37
+ - **ESLint plugin** with 18 deterministic rules and 4 presets (`recommended`, `strict`, `security`, `agent`)
38
+ - **CLI** (`ai-guard`) for terminal, changed-file, and CI scanning
39
+ - **GitHub Action** with native SARIF 2.1.0 output for GitHub Code Scanning
40
+ - **Claude Code integration** with a zero-config PostToolUse hook
41
+ - **MCP server** (`ai-guard-mcp`) for local AI-agent workflows over STDIO
42
+
43
+ It is engineered to detect reliability bugs, async hazards, security vulnerabilities, and code-scaffolding defects frequently introduced during AI-assisted development (GitHub Copilot, Cursor, Claude Code, Gemini Code Assist, etc.).
37
44
 
38
45
  AI Guard analyzes Abstract Syntax Trees (AST) using ESLint's native engine. It runs locally in your editor, in your terminal via the zero-config CLI, and in your CI/CD pipelines via native SARIF 2.1.0 integration with GitHub Code Scanning.
39
46
 
@@ -87,7 +94,7 @@ flowchart TD
87
94
  end
88
95
 
89
96
  subgraph Tiers["3. Classification & Presets"]
90
- E --> F{"Active Preset\n(recommended | strict | security)"}
97
+ E --> F{"Active Preset\n(recommended | strict | security | agent)"}
91
98
  F --> G["Confidence Tiering & AST Filtering"]
92
99
  end
93
100
 
@@ -265,6 +272,8 @@ npx ai-guard <command> [options]
265
272
  | `preset` | Interactively select and switch active preset in config | (Interactive prompt with automatic config patch & backup) |
266
273
  | `ignore` | Add standard ignore paths (`.next`, `dist`, `build`) to config | (Patches flat config or legacy ignores safely) |
267
274
 
275
+ **`run` exit codes:** `0` no errors · `1` errors found (or `--max-warnings` exceeded) · `2` scan did not run — the file passed to `--path` matches a built-in ignore pattern (`node_modules/`, `dist/`, `build/`, `generated/`, `vendor/`, …), so nothing was analyzed. Directory scans skip ignored files silently and never exit `2`.
276
+
268
277
  ### CLI Usage Examples
269
278
 
270
279
  ```bash
@@ -614,6 +623,44 @@ For the complete methodology, raw findings, and benchmark harness, see [**`docs/
614
623
 
615
624
  ---
616
625
 
626
+ ## MCP Server (Model Context Protocol)
627
+
628
+ AI Guard includes a local MCP server that exposes its deterministic analysis engine to MCP-capable AI clients (Claude Code, Claude Desktop, and other MCP-compatible integrations).
629
+
630
+ ```bash
631
+ npx --yes --package eslint-plugin-ai-guard ai-guard-mcp
632
+ ```
633
+
634
+ **Available tools:**
635
+
636
+ | Tool | Description |
637
+ | :--- | :--- |
638
+ | `ai_guard_scan_file` | Scan a single JS/TS file with structured findings |
639
+ | `ai_guard_scan_diff` | Scan changed files in git diff (including newly created untracked JS/TS files) |
640
+ | `ai_guard_scan_project` | Scan a bounded workspace directory (current source; not yet published) |
641
+ | `ai_guard_rules` | List rules and presets, or look up specific rules (`rules: ["no-floating-promise"]`) with remediation and docs link |
642
+
643
+ All tools declare an `outputSchema`; the text content is the same result as compact JSON. Scan tools accept `maxIssues` (default 50, errors first, exact `totalIssues` and `truncated`). The `verify_changes` prompt runs the scan → fix → rescan loop.
644
+
645
+ **Claude Code configuration** (project-root `.mcp.json`):
646
+
647
+ ```json
648
+ {
649
+ "mcpServers": {
650
+ "ai-guard": {
651
+ "type": "stdio",
652
+ "command": "node",
653
+ "args": ["/absolute/path/to/ai-guard/dist/mcp/server.js"],
654
+ "env": { "AI_GUARD_WORKSPACE": "/absolute/path/to/project" }
655
+ }
656
+ }
657
+ }
658
+ ```
659
+
660
+ The SDK in-memory and built STDIO integrations are tested, plus a headless Claude Code CLI smoke test (see the MCP guide for scope). Use the built checkout to test unreleased changes. Scan, fix, then rescan; a partial or failed scan is never clean. For setup, result status, limits, and client verification scope, see [**`docs/mcp-server.md`**](./docs/mcp-server.md).
661
+
662
+ ---
663
+
617
664
  ## Learn More & Ecosystem
618
665
 
619
666
  Visit [getaiguard.dev](https://getaiguard.dev) to explore interactive documentation, rule catalogs, benchmarks, and deep-dive engineering articles.