eslint-plugin-ai-guard 1.4.7 → 1.4.8
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 +70 -36
- package/dist/cli/hook.js +5116 -17147
- package/dist/cli/index.js +5446 -31314
- package/dist/index.d.mts +123 -47
- package/dist/index.d.ts +123 -47
- package/dist/index.js +3001 -644
- package/dist/index.mjs +2991 -637
- package/dist/mcp/server.js +5140 -59639
- package/package.json +112 -110
- package/dist/cli/hook.js.map +0 -1
- package/dist/cli/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/mcp/server.js.map +0 -1
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
## What is AI Guard?
|
|
35
35
|
|
|
36
36
|
**AI Guard** (`eslint-plugin-ai-guard`) provides:
|
|
37
|
-
- **ESLint plugin** with
|
|
37
|
+
- **ESLint plugin** with 33 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
|
|
@@ -63,7 +63,7 @@ AI Guard analyzes Abstract Syntax Trees (AST) using ESLint's native engine. It r
|
|
|
63
63
|
> [!IMPORTANT]
|
|
64
64
|
> - **AI Guard is NOT an AI detector.** It does not attempt to predict whether code was authored by an LLM or a human.
|
|
65
65
|
> - **AI Guard detects dangerous or fragile code patterns** that LLMs repeatedly introduce due to incomplete context, hallucinated patterns, or probabilistic generation.
|
|
66
|
-
> - **AI Guard does NOT replace ESLint.** It extends ESLint with
|
|
66
|
+
> - **AI Guard does NOT replace ESLint.** It extends ESLint with 33 specialized, high-impact rules that core ESLint and standard configurations omit.
|
|
67
67
|
|
|
68
68
|
---
|
|
69
69
|
|
|
@@ -104,7 +104,7 @@ flowchart TD
|
|
|
104
104
|
subgraph Analysis["2. Deterministic AST Analysis"]
|
|
105
105
|
B --> C["ESLint Parser\n(espree / @typescript-eslint/parser)"]
|
|
106
106
|
C --> D["AST Representation"]
|
|
107
|
-
D --> E["AI Guard Rules Engine\n(
|
|
107
|
+
D --> E["AI Guard Rules Engine\n(33 Deterministic Rules)"]
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
subgraph Tiers["3. Classification & Presets"]
|
|
@@ -131,9 +131,9 @@ flowchart TD
|
|
|
131
131
|
|
|
132
132
|
## Rules Catalog
|
|
133
133
|
|
|
134
|
-
AI Guard includes **
|
|
134
|
+
AI Guard includes **33 deterministic rules** divided into four specialized categories. Every rule is engineered with low false-positive heuristics and validated against real-world production codebases:
|
|
135
135
|
|
|
136
|
-
### 🔴 Security (
|
|
136
|
+
### 🔴 Security (13 Rules)
|
|
137
137
|
|
|
138
138
|
| Rule | Recommended | What It Catches | Fixable? |
|
|
139
139
|
| :--- | :---: | :--- | :---: |
|
|
@@ -147,8 +147,11 @@ AI Guard includes **27 deterministic rules** divided into four specialized categ
|
|
|
147
147
|
| [`no-invisible-unicode`](./docs/rules/no-invisible-unicode.md) | **`error`** | Trojan Source bidi overrides, zero-width and Hangul-filler characters, and Unicode tag characters that hide instructions for AI tools (decoded in the message). | **Yes** (escapes in strings, removal in comments) |
|
|
148
148
|
| [`no-unsanitized-html`](./docs/rules/no-unsanitized-html.md) | `warn` | Dynamic values in `innerHTML`, `insertAdjacentHTML`, `document.write` and `dangerouslySetInnerHTML`, with sharper messages for URL input, LLM output, markdown and JSON-LD. | No |
|
|
149
149
|
| [`no-undeclared-import`](./docs/rules/no-undeclared-import.md) | `warn` | Imports of packages missing from package.json: hallucinated names (slopsquatting) and phantom dependencies. Offline and monorepo-aware. | No |
|
|
150
|
+
| [`no-insecure-random`](./docs/rules/no-insecure-random.md) | `warn` | `Math.random()` used for tokens, passwords, one-time codes, reset links and other values that must be unguessable. | No |
|
|
151
|
+
| [`no-jwt-decode-as-verify`](./docs/rules/no-jwt-decode-as-verify.md) | `warn` | `jsonwebtoken` `decode()` in a file that never calls `verify()`: the signature is never checked, so tokens can be forged. | No |
|
|
152
|
+
| [`no-permissive-cors`](./docs/rules/no-permissive-cors.md) | `warn` | CORS that accepts every origin (`origin: true`, an allow-all callback, a reflected `Origin` header) while allowing credentials. | No |
|
|
150
153
|
|
|
151
|
-
### 🟠 Reliability (
|
|
154
|
+
### 🟠 Reliability (6 Rules)
|
|
152
155
|
|
|
153
156
|
| Rule | Recommended | What It Catches | Fixable? |
|
|
154
157
|
| :--- | :---: | :--- | :---: |
|
|
@@ -157,6 +160,7 @@ AI Guard includes **27 deterministic rules** divided into four specialized categ
|
|
|
157
160
|
| [`no-catch-log-rethrow`](./docs/rules/no-catch-log-rethrow.md) | `off`* | Catch blocks that only log to `console` and rethrow without adding context or diagnostic info. | No |
|
|
158
161
|
| [`no-catch-without-use`](./docs/rules/no-catch-without-use.md) | `off`* | Caught error variables that are declared in catch parameters but never referenced. | No |
|
|
159
162
|
| [`no-silent-fallback`](./docs/rules/no-silent-fallback.md) | `warn` | Secret env vars with hardcoded fallbacks (`process.env.JWT_SECRET \|\| 'secret'`) and `catch { return [] }` around awaited I/O. | No |
|
|
163
|
+
| [`no-unvalidated-cast`](./docs/rules/no-unvalidated-cast.md) | `off`* | `res.json()`, `JSON.parse()` or `req.body` cast to a type (`as User`) without runtime validation. TypeScript only. | No |
|
|
160
164
|
|
|
161
165
|
### 🟡 Async Stability (5 Rules)
|
|
162
166
|
|
|
@@ -168,7 +172,7 @@ AI Guard includes **27 deterministic rules** divided into four specialized categ
|
|
|
168
172
|
| [`no-async-without-await`](./docs/rules/no-async-without-await.md) | `warn` | Functions declared `async` that never execute an `await` expression, adding unnecessary Promise overhead. | No |
|
|
169
173
|
| [`no-redundant-await`](./docs/rules/no-redundant-await.md) | `off`* | Redundant `return await` statements outside of `try...catch` blocks. | No |
|
|
170
174
|
|
|
171
|
-
### 🔵 AI Patterns (
|
|
175
|
+
### 🔵 AI Patterns (9 Rules)
|
|
172
176
|
|
|
173
177
|
| Rule | Recommended | What It Catches | Fixable? |
|
|
174
178
|
| :--- | :---: | :--- | :---: |
|
|
@@ -176,6 +180,8 @@ AI Guard includes **27 deterministic rules** divided into four specialized categ
|
|
|
176
180
|
| [`no-duplicate-logic-block`](./docs/rules/no-duplicate-logic-block.md) | `off`* | Consecutive duplicate code blocks or repeated conditional branches duplicated during AI edits. | No |
|
|
177
181
|
| [`no-console-in-handler`](./docs/rules/no-console-in-handler.md) | `off`* | Unstructured `console.log` statements left in HTTP route handlers instead of production loggers. | No |
|
|
178
182
|
| [`no-placeholder-implementation`](./docs/rules/no-placeholder-implementation.md) | `warn` | Code an agent left unfinished: `// ... rest of the code` elisions that delete code, TODO-only stubs, `throw new Error('Not implemented')` bodies, and mock data served from production code. | No |
|
|
183
|
+
| [`no-unknown-export`](./docs/rules/no-unknown-export.md) | `warn` | Names, subpaths and default imports the installed package does not export: `import { useQueryState } from 'react-router'`. Reports only when the package's full export list is proven (checked against Node's loader and the TypeScript compiler on 400+ packages). Suggests the closest real export. | No |
|
|
184
|
+
| [`no-stale-api`](./docs/rules/no-stale-api.md) | `warn` | APIs the installed package version has removed, which models keep writing from older training data: `ReactDOM.render` on React 19, `useHistory` on React Router 6, the openai v3 client, Express 5 removals. Reads the installed version offline. | No |
|
|
179
185
|
| [`no-tautological-assertion`](./docs/rules/no-tautological-assertion.md) | `warn` | Assertions that always pass: `expect(true).toBe(true)`, `expect(x).toEqual(x)`, `assert.ok(1)`. | No |
|
|
180
186
|
| [`no-assertionless-test`](./docs/rules/no-assertionless-test.md) | `warn` | Test cases with no assertion, which pass whatever the code does. | No |
|
|
181
187
|
| [`no-test-env-branch`](./docs/rules/no-test-env-branch.md) | `warn` | Production code that returns a canned result under a test runner (`if (NODE_ENV === 'test') return true`). | No |
|
|
@@ -195,6 +201,7 @@ Linting checks the code. These check the agent:
|
|
|
195
201
|
| [`ai-guard changed --test-integrity`](./docs/cli/test-integrity.md) | A test-focused comparison: focused, skipped, removed or weakened tests, rewritten snapshots, and test commands that can no longer fail. Overlaps with `integrity`; use `integrity` for the full set. |
|
|
196
202
|
| [`ai-guard verify-deps`](./docs/cli/verify-deps.md) | Checks npm packages before they are installed: names that don't exist (invented by assistants), look-alikes of popular packages, new or rarely used packages, install scripts, deprecations, and releases published in the last day (skipped when the package manager enforces a release cooldown). Also as a pre-install hook for Claude Code, Cursor and Codex (`init-hooks --check-installs`) and the `ai_guard_check_package` MCP tool. Uses the npm registry; private registries are skipped. |
|
|
197
203
|
| [`ai-guard scan-agent-config`](./docs/cli/scan-agent-config.md) | Scans `CLAUDE.md`, `AGENTS.md`, `.cursorrules`, skills and MCP configs for hidden text, prompt injection, unpinned MCP servers and inline secrets. |
|
|
204
|
+
| [`ai-guard duplicates`](./docs/cli/duplicates.md) | Code the change copied from elsewhere in the repository, renamed variables and changed literals included (winnowing over parser tokens; 38–39 of 40 real copies found in every variant of the validation benchmark, no false reports on unrelated code). Also disclosed by `verify`, so agents are told before they finish. |
|
|
198
205
|
| [Agent hooks: Claude Code, Cursor, Codex](./docs/integrations/agents.md) | `ai-guard init-hooks` sets up every agent a project uses. Findings reach the agent after edits; before it finishes, the whole change is verified once; `git commit --no-verify` and risky installs are caught before they run. |
|
|
199
206
|
| [Pre-commit gate](./docs/integrations/git-hook.md) | `ai-guard init-git-hook` runs `verify --staged` on every commit through husky, lefthook, simple-git-hooks or pre-commit. Only problems the commit introduces block it. |
|
|
200
207
|
| [MCP tools](./docs/mcp-server.md) | `ai_guard_scan_file`, `ai_guard_scan_diff`, `ai_guard_scan_project`, `ai_guard_rules`, `ai_guard_check_integrity`, `ai_guard_verify_change`, `ai_guard_scan_agent_config`, `ai_guard_check_package`, and `ai_guard_fix` (a diff, unless `apply` is set). |
|
|
@@ -207,16 +214,32 @@ AI Guard exports four official configurations ready for flat config or legacy se
|
|
|
207
214
|
|
|
208
215
|
| Preset | Description | Configuration Focus |
|
|
209
216
|
| :--- | :--- | :--- |
|
|
210
|
-
| **`recommended`** | **Default.** Balanced adoption preset. Enables 6 high-confidence critical rules at `error`,
|
|
211
|
-
| **`strict`** | Enforces **all
|
|
212
|
-
| **`security`** | Focuses on the **
|
|
217
|
+
| **`recommended`** | **Default.** Balanced adoption preset. Enables 6 high-confidence critical rules at `error`, 21 context-sensitive rules at `warn`, and disables 6 noisy rules. Zero noise on day one. | Production codebases, new teams |
|
|
218
|
+
| **`strict`** | Enforces **all 33 rules at `error`**. Designed for zero-tolerance CI gates, high-assurance software, and mature teams. | Strict CI/CD quality gates |
|
|
219
|
+
| **`security`** | Focuses on the **14 security-relevant rules** (secrets, eval, SQL, client-exposed secrets, invisible Unicode and HTML sinks at `error`; the rest at `warn`). | AppSec auditing & security scans |
|
|
213
220
|
| **`agent`** | **8 high-signal rules at `error`**. Optimized for AI-agent editing workflows where lint feedback runs immediately after each file edit (e.g., PostToolUse hooks). | Claude Code, Cursor, real-time agent loops |
|
|
214
221
|
|
|
215
222
|
---
|
|
216
223
|
|
|
217
224
|
## Quick Start & Installation
|
|
218
225
|
|
|
219
|
-
|
|
226
|
+
**Try it first, without installing anything or touching your config:**
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
npx eslint-plugin-ai-guard run
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
It scans the current project with the `recommended` preset and changes no files. No ESLint configuration is needed. In a TypeScript project without `@typescript-eslint/parser`, add `-p @typescript-eslint/parser` (`npx -p eslint-plugin-ai-guard -p @typescript-eslint/parser ai-guard run`) so `.ts` files are parsed.
|
|
233
|
+
|
|
234
|
+
**One command sets up everything:**
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
npx eslint-plugin-ai-guard protect
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
It installs AI Guard as a devDependency (plus `@typescript-eslint/parser` in TypeScript projects), adds hooks for the coding agents the project uses (Claude Code, Cursor, Codex), adds a pre-commit gate, checks `CLAUDE.md`, `AGENTS.md` and MCP config, and prints one screen saying what is now protected. Running it again changes nothing. Preview with `--dry-run`; agents can read `--json`. See [protect](./docs/cli/protect.md).
|
|
241
|
+
|
|
242
|
+
Or install the package yourself as a development dependency:
|
|
220
243
|
|
|
221
244
|
```bash
|
|
222
245
|
# npm
|
|
@@ -232,6 +255,17 @@ yarn add -D eslint-plugin-ai-guard
|
|
|
232
255
|
bun add -d eslint-plugin-ai-guard
|
|
233
256
|
```
|
|
234
257
|
|
|
258
|
+
> [!NOTE]
|
|
259
|
+
> Once AI Guard is installed in a project, its CLI is `ai-guard` (`npx ai-guard run`). Before it is installed, use the package name: `npx eslint-plugin-ai-guard run`. A bare `npx ai-guard` in a project without AI Guard fetches a different npm package that happens to be called `ai-guard`.
|
|
260
|
+
|
|
261
|
+
### Add a badge to your README
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
npx eslint-plugin-ai-guard badge
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
It scans the project, writes the result to `.github/ai-guard-badge.json` (a [shields.io endpoint](https://shields.io/badges/endpoint-badge) file) and prints the Markdown for your README. The badge shows what the scan found: `passing`, a warning count or an error count. Commit the file. To keep the badge current, run the command in CI on pushes to your default branch; see [badge](./docs/cli/badge.md). Nothing is sent anywhere: shields.io reads the file from your repository.
|
|
268
|
+
|
|
235
269
|
### Requirements
|
|
236
270
|
|
|
237
271
|
- **Node.js:** `>= 20.0.0`
|
|
@@ -242,43 +276,33 @@ bun add -d eslint-plugin-ai-guard
|
|
|
242
276
|
|
|
243
277
|
## ESLint Configuration
|
|
244
278
|
|
|
245
|
-
### 1.
|
|
279
|
+
### 1. Flat Config (ESLint 9 and 10: `eslint.config.mjs` / `eslint.config.js`)
|
|
246
280
|
|
|
247
|
-
|
|
281
|
+
Each `flat/` preset is a complete flat config that registers the plugin itself:
|
|
248
282
|
|
|
249
283
|
```javascript
|
|
250
284
|
// eslint.config.mjs
|
|
251
285
|
import aiGuard from 'eslint-plugin-ai-guard';
|
|
252
286
|
|
|
287
|
+
export default [aiGuard.configs['flat/recommended']];
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Use `aiGuard.configs['flat/strict']` (all 33 rules at error), `aiGuard.configs['flat/security']` (security rules only) or `aiGuard.configs['flat/agent']` (8 high-signal rules for agent hooks) the same way. To override a rule, add a config object after the preset:
|
|
291
|
+
|
|
292
|
+
```javascript
|
|
253
293
|
export default [
|
|
294
|
+
aiGuard.configs['flat/recommended'],
|
|
254
295
|
{
|
|
255
|
-
plugins: {
|
|
256
|
-
'ai-guard': aiGuard,
|
|
257
|
-
},
|
|
258
296
|
rules: {
|
|
259
|
-
...aiGuard.configs.recommended.rules,
|
|
260
|
-
// Custom overrides if desired:
|
|
261
297
|
'ai-guard/no-floating-promise': 'error',
|
|
262
298
|
},
|
|
263
299
|
},
|
|
264
300
|
];
|
|
265
301
|
```
|
|
266
302
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
```javascript
|
|
270
|
-
// Strict preset — all 27 rules at error
|
|
271
|
-
rules: {
|
|
272
|
-
...aiGuard.configs.strict.rules,
|
|
273
|
-
}
|
|
303
|
+
Spreading the rules into your own config object (`plugins: { 'ai-guard': aiGuard }, rules: { ...aiGuard.configs.recommended.rules }`) keeps working.
|
|
274
304
|
|
|
275
|
-
|
|
276
|
-
rules: {
|
|
277
|
-
...aiGuard.configs.security.rules,
|
|
278
|
-
}
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
### 2. Legacy Config (`.eslintrc.js` / `.eslintrc.json`)
|
|
305
|
+
### 2. Legacy Config (ESLint 8, or ESLint 9 with `ESLINT_USE_FLAT_CONFIG=false`)
|
|
282
306
|
|
|
283
307
|
```javascript
|
|
284
308
|
// .eslintrc.js
|
|
@@ -288,6 +312,9 @@ module.exports = {
|
|
|
288
312
|
};
|
|
289
313
|
```
|
|
290
314
|
|
|
315
|
+
> [!NOTE]
|
|
316
|
+
> 2.0 will make the plain preset names (`recommended`, `strict`, `security`, `agent`) flat configs. To be ready, `.eslintrc` files can already use the aliases `plugin:ai-guard/legacy-recommended` (and `legacy-strict`, `legacy-security`, `legacy-agent`), which keep working after that upgrade. ESLint 10 no longer reads `.eslintrc` files at all.
|
|
317
|
+
|
|
291
318
|
---
|
|
292
319
|
|
|
293
320
|
## CLI Reference
|
|
@@ -295,18 +322,21 @@ module.exports = {
|
|
|
295
322
|
AI Guard includes a full-featured CLI binary (`ai-guard`) that runs out of the box with zero ESLint configuration files required:
|
|
296
323
|
|
|
297
324
|
```bash
|
|
298
|
-
npx ai-guard <command> [options]
|
|
325
|
+
npx ai-guard <command> [options] # AI Guard installed in the project
|
|
326
|
+
npx eslint-plugin-ai-guard <command> [options] # not installed (first run, one-off scans)
|
|
299
327
|
```
|
|
300
328
|
|
|
301
329
|
### Core Commands
|
|
302
330
|
|
|
303
331
|
| Command | Purpose | Common Options |
|
|
304
332
|
| :--- | :--- | :--- |
|
|
333
|
+
| `protect` | Set up everything in one step: install, agent hooks, pre-commit gate, agent-config check ([docs](./docs/cli/protect.md)) | `--agent <list>`, `--manager <name>`, `--check-installs`, `--no-install`, `--no-agent-hooks`, `--no-git-hook`, `--dry-run`, `--json` |
|
|
305
334
|
| `run` | Scan your workspace using AI Guard AST rules | `--path <dir>`, `--strict`, `--security`, `--json`, `--sarif`, `--fail-on <level>`, `--max-warnings <n>`, `--inline-suppressions <mode>` |
|
|
306
335
|
| `changed` | Fast CI scan — only scans modified files in git | `--pr`, `--staged`, `--base <branch>`, `--baseline [file]`, `--integrity <off\|report\|enforce>`, `--test-integrity`, `--inline-suppressions <mode>`, `--strict`, `--sarif`, `--sarif-output <file>`, `--fail-on <level>` |
|
|
307
336
|
| `verify` | One verdict for the current change ([docs](./docs/cli/verify.md)) | `--base <ref>`, `--staged`, `--preset <name>`, `--strict`, `--json` |
|
|
308
337
|
| `verify-deps` | Check npm packages before they are installed ([docs](./docs/cli/verify-deps.md)) | `[packages...]`, `--base <ref>`, `--staged`, `--all`, `--json`, `--sarif`, `--fail-on <level>` |
|
|
309
338
|
| `scan-agent-config` | Scan agent instructions and MCP config ([docs](./docs/cli/scan-agent-config.md)) | `--path <dir>`, `--json`, `--sarif`, `--fail-on <level>`, `--update-lock` |
|
|
339
|
+
| `duplicates` | Report code a change copied from elsewhere in the repository ([docs](./docs/cli/duplicates.md)) | `--base <ref>`, `--staged`, `--all`, `--include-tests`, `--min-tokens <n>`, `--json`, `--sarif`, `--fail-on <level>` |
|
|
310
340
|
| `integrity` | Detect changes that weaken checks vs a base revision ([docs](./docs/integrity.md)) | `--base <ref>`, `--pr`, `--staged`, `--enforce`, `--json`, `--sarif`, `--accept <fingerprints\|all>` |
|
|
311
341
|
| `init` | Automatically detect environment & configure ESLint | `--preset <name>`, `--flat`, `--dry-run`, `-y, --yes` |
|
|
312
342
|
| `init-hooks` | Hooks for Claude Code, Cursor and Codex ([docs](./docs/integrations/agents.md)) | `--agent <list>`, `--check-installs`, `--no-stop-hook`, `--no-bash-guard`, `--dry-run` |
|
|
@@ -315,6 +345,7 @@ npx ai-guard <command> [options]
|
|
|
315
345
|
| `init-context` | Generate prompt instruction files for AI coding agents | `-a, --all`, `--force`, `--dry-run`, `--rules <categories>` |
|
|
316
346
|
| `doctor` | Diagnose your ESLint, parser, and plugin environment | (No options needed — prints actionable diagnostic report) |
|
|
317
347
|
| `baseline` | Record existing findings, then report only new ones | `create`, `check`, `--fail-on <level>`, `--json`, `--mode <strict\|stable>`, `--preset <name>` |
|
|
348
|
+
| `badge` | Scan and write a README badge with the result ([docs](./docs/cli/badge.md)) | `--path <dir>`, `--preset <name>`, `--output <file>`, `--json` |
|
|
318
349
|
| `report` | Generate an interactive standalone HTML audit report | `--path <dir>`, `--preset <name>`, `--output <file>`, `--no-open`, `--json` |
|
|
319
350
|
| `preset` | Interactively select and switch active preset in config | (Interactive prompt with automatic config patch & backup) |
|
|
320
351
|
| `ignore` | Add standard ignore paths (`.next`, `dist`, `build`) to config | (Patches flat config or legacy ignores safely) |
|
|
@@ -324,8 +355,11 @@ npx ai-guard <command> [options]
|
|
|
324
355
|
### CLI Usage Examples
|
|
325
356
|
|
|
326
357
|
```bash
|
|
327
|
-
#
|
|
328
|
-
npx ai-guard
|
|
358
|
+
# 0. Set up hooks, the pre-commit gate and the agent-config check in one step
|
|
359
|
+
npx eslint-plugin-ai-guard protect
|
|
360
|
+
|
|
361
|
+
# 1. Immediate scan of current directory (no install needed)
|
|
362
|
+
npx eslint-plugin-ai-guard run
|
|
329
363
|
|
|
330
364
|
# 2. Strict CI scan failing only on high-confidence issues
|
|
331
365
|
npx ai-guard run --strict --fail-on high
|
|
@@ -667,7 +701,7 @@ Conventional linters either omit AI-specific hazards entirely or require heavywe
|
|
|
667
701
|
| **Elided / stubbed code left by agents** | [`no-placeholder-implementation`](./docs/rules/no-placeholder-implementation.md) | Partial: `no-warning-comments` *(TODO text only)* | ❌ None |
|
|
668
702
|
|
|
669
703
|
> [!TIP]
|
|
670
|
-
> **Minimal Type-Information Dependency:**
|
|
704
|
+
> **Minimal Type-Information Dependency:** 32 of 33 AI Guard rules operate in pure syntax/scope-analysis mode without `projectService` or `tsconfig.json`. The `no-floating-promise` rule optionally uses TypeScript parser services for higher recall on cross-module Promise calls, with syntax/scope-based heuristics as a zero-config fallback.
|
|
671
705
|
|
|
672
706
|
---
|
|
673
707
|
|