eslint-plugin-ai-guard 1.4.1 → 1.4.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.
- package/README.md +30 -5
- package/THIRD-PARTY-NOTICES.md +923 -0
- package/dist/cli/index.js +21665 -6350
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +144 -101
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +144 -101
- package/dist/index.mjs.map +1 -1
- package/dist/mcp/server.js +52835 -3919
- package/dist/mcp/server.js.map +1 -1
- package/package.json +15 -13
package/README.md
CHANGED
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
- **ESLint plugin** with 18 deterministic rules and 4 presets (`recommended`, `strict`, `security`, `agent`)
|
|
38
38
|
- **CLI** (`ai-guard`) for terminal, changed-file, and CI scanning
|
|
39
39
|
- **GitHub Action** with native SARIF 2.1.0 output for GitHub Code Scanning
|
|
40
|
-
- **
|
|
40
|
+
- **Check integrity** (`ai-guard integrity`) — detects changes that weaken checks: new suppressions, skipped or removed tests, lowered ESLint/TypeScript/coverage settings, removed CI steps
|
|
41
|
+
- **Claude Code integration** with hooks that send findings back to Claude and block finishing once when checks were weakened
|
|
41
42
|
- **MCP server** (`ai-guard-mcp`) for local AI-agent workflows over STDIO
|
|
42
43
|
|
|
43
44
|
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.).
|
|
@@ -262,8 +263,9 @@ npx ai-guard <command> [options]
|
|
|
262
263
|
|
|
263
264
|
| Command | Purpose | Common Options |
|
|
264
265
|
| :--- | :--- | :--- |
|
|
265
|
-
| `run` | Scan your workspace using AI Guard AST rules | `--path <dir>`, `--strict`, `--security`, `--json`, `--sarif`, `--fail-on <level>`, `--max-warnings <n>` |
|
|
266
|
-
| `changed` | Fast CI scan — only scans modified files in git | `--pr`, `--staged`, `--base <branch>`, `--strict`, `--sarif`, `--sarif-output <file>`, `--fail-on <level>` |
|
|
266
|
+
| `run` | Scan your workspace using AI Guard AST rules | `--path <dir>`, `--strict`, `--security`, `--json`, `--sarif`, `--fail-on <level>`, `--max-warnings <n>`, `--inline-suppressions <mode>` |
|
|
267
|
+
| `changed` | Fast CI scan — only scans modified files in git | `--pr`, `--staged`, `--base <branch>`, `--baseline [file]`, `--integrity <off\|report\|enforce>`, `--inline-suppressions <mode>`, `--strict`, `--sarif`, `--sarif-output <file>`, `--fail-on <level>` |
|
|
268
|
+
| `integrity` | Detect changes that weaken checks vs a base revision ([docs](./docs/integrity.md)) | `--base <ref>`, `--pr`, `--staged`, `--enforce`, `--json`, `--sarif`, `--accept <fingerprints\|all>` |
|
|
267
269
|
| `init` | Automatically detect environment & configure ESLint | `--preset <name>`, `--flat`, `--dry-run`, `-y, --yes` |
|
|
268
270
|
| `init-context` | Generate prompt instruction files for AI coding agents | `-a, --all`, `--force`, `--dry-run`, `--rules <categories>` |
|
|
269
271
|
| `doctor` | Diagnose your ESLint, parser, and plugin environment | (No options needed — prints actionable diagnostic report) |
|
|
@@ -295,8 +297,23 @@ npx ai-guard report --output ai-guard-report.html
|
|
|
295
297
|
# 6. Save existing issues as baseline and only fail on new regressions
|
|
296
298
|
npx ai-guard baseline --save
|
|
297
299
|
npx ai-guard baseline --check
|
|
300
|
+
|
|
301
|
+
# 7. Fail a PR that skips tests, adds eslint-disable, or lowers coverage thresholds
|
|
302
|
+
npx ai-guard changed --pr --integrity enforce
|
|
298
303
|
```
|
|
299
304
|
|
|
305
|
+
### Inline suppressions never hide findings silently
|
|
306
|
+
|
|
307
|
+
AI Guard reads `eslint-disable` directives itself; ESLint's own inline config is disabled in AI Guard's private ESLint instance, so a comment cannot make a finding vanish without a trace. `--inline-suppressions` selects the policy:
|
|
308
|
+
|
|
309
|
+
| Mode | Effect |
|
|
310
|
+
|---|---|
|
|
311
|
+
| `allow` (default) | A covering directive hides the finding from totals and exit codes; it is listed under "Hidden by inline directives" (JSON `suppressedIssues`, step summary, SARIF `suppressedFindingsCount`) |
|
|
312
|
+
| `require-reason` | Only directives with a ` -- reason` hide findings (used by the Claude Code hook) |
|
|
313
|
+
| `ignore` | Directives never hide AI Guard findings (always used by the MCP server) |
|
|
314
|
+
|
|
315
|
+
This applies to `ai-guard run`, `changed`, the GitHub Action, the Claude Code hook and MCP. It does not change how your own `eslint .` treats directives. TypeScript comments (`@ts-ignore`, `@ts-nocheck`) never affect AI Guard findings; `ai-guard integrity` reports newly added ones.
|
|
316
|
+
|
|
300
317
|
---
|
|
301
318
|
|
|
302
319
|
## AI Agent Integration (`init-context`)
|
|
@@ -332,14 +349,16 @@ This dual-layer defense minimizes review friction and ensures generated code mee
|
|
|
332
349
|
|
|
333
350
|
## Claude Code Integration
|
|
334
351
|
|
|
335
|
-
AI Guard integrates directly with [Claude Code](https://
|
|
352
|
+
AI Guard integrates directly with [Claude Code](https://code.claude.com/docs/en/hooks) through hooks:
|
|
336
353
|
|
|
337
354
|
```bash
|
|
338
355
|
# One-command setup
|
|
339
356
|
npx ai-guard init-claude
|
|
340
357
|
```
|
|
341
358
|
|
|
342
|
-
|
|
359
|
+
- **PostToolUse** — after each edit, findings from the `agent` preset and newly weakened checks in the edited file are sent back to Claude (`decision: "block"` + `reason`, per the hooks protocol). Earlier versions printed plain stdout, which Claude Code does not show to Claude.
|
|
360
|
+
- **SessionStart + Stop** — before Claude finishes, [check integrity](./docs/integrity.md) runs on everything changed in the session. High-confidence weakenings (a new `.skip`, `eslint-disable`, lowered threshold…) block stopping once per finding set; advisories are shown to you, never block.
|
|
361
|
+
- **PreToolUse (Bash)** — `git commit --no-verify` / `HUSKY=0` ask for confirmation.
|
|
343
362
|
|
|
344
363
|
```bash
|
|
345
364
|
# Preview before applying
|
|
@@ -414,6 +433,9 @@ jobs:
|
|
|
414
433
|
| `package-manager` | Package manager: `auto` \| `npm` \| `pnpm` \| `yarn` | `'auto'` |
|
|
415
434
|
| `sarif-output` | Output filepath for generated SARIF report | `'ai-guard-results.sarif'` |
|
|
416
435
|
| `install-deps` | Install project dependencies prior to scanning | `'true'` |
|
|
436
|
+
| `baseline` | Committed baseline file; with `changed-only`, report only findings not in it | `''` |
|
|
437
|
+
| `integrity` | Check integrity: `off` \| `report` \| `enforce` (needs `changed-only` and `fetch-depth: 0`) | `'off'` |
|
|
438
|
+
| `inline-suppressions` | `allow` \| `require-reason` \| `ignore` for eslint-disable directives covering AI Guard findings | `''` (allow) |
|
|
417
439
|
|
|
418
440
|
### Action Outputs
|
|
419
441
|
|
|
@@ -423,6 +445,8 @@ jobs:
|
|
|
423
445
|
| `high-confidence-count` | Number of high-confidence issues flagged |
|
|
424
446
|
| `medium-confidence-count` | Number of medium-confidence issues flagged |
|
|
425
447
|
| `files-scanned` | Count of files analyzed during the execution |
|
|
448
|
+
| `integrity-high-count` | High-confidence check-integrity findings (when `integrity` is enabled) |
|
|
449
|
+
| `integrity-advisory-count` | Advisory check-integrity findings (when `integrity` is enabled) |
|
|
426
450
|
| `sarif-file` | Absolute path to the generated SARIF 2.1.0 artifact |
|
|
427
451
|
| `duration-ms` | Total scan execution duration in milliseconds |
|
|
428
452
|
|
|
@@ -639,6 +663,7 @@ npx --yes --package eslint-plugin-ai-guard ai-guard-mcp
|
|
|
639
663
|
| `ai_guard_scan_diff` | Scan changed files in git diff (including newly created untracked JS/TS files) |
|
|
640
664
|
| `ai_guard_scan_project` | Scan a bounded workspace directory (current source; not yet published) |
|
|
641
665
|
| `ai_guard_rules` | List rules and presets, or look up specific rules (`rules: ["no-floating-promise"]`) with remediation and docs link |
|
|
666
|
+
| `ai_guard_check_integrity` | Report checks weakened by current Git changes (new suppressions, skipped/removed tests, lowered configs, removed CI steps), with `tier` and `hasBlockingFindings` |
|
|
642
667
|
|
|
643
668
|
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
669
|
|