npm package: @promptshield/ignore
Description: Ignore directive parser and threat filtering utilities for PromptShield. Provides file-level and line-level suppression logic for CLI and IDE integrations.
Author: Mayank Kumar Chaudhari
Latest version: 2.0.0

# @promptshield/ignore <img src="https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png" style="height: 40px"/>

<img alt="PromptShield Banner" src="https://raw.githubusercontent.com/promptshield-io/promptshield/main/banner.gif" />

<p className="flex gap-2">
  <a href="https://github.com/promptshield-io/promptshield/actions/workflows/ci.yml" rel="noopener noreferrer">
    <img alt="CI" src="https://github.com/promptshield-io/promptshield/actions/workflows/ci.yml/badge.svg" />
  </a>
  <a href="https://codecov.io/gh/promptshield-io/promptshield/tree/main/packages/@promptshield/ignore" rel="noopener noreferrer">
    <img alt="codecov" src="https://codecov.io/gh/promptshield-io/promptshield/graph/badge.svg?flag=@promptshield/ignore" />
  </a> 
  <a href="https://npmjs.com/package/@promptshield/ignore" rel="noopener noreferrer">
    <img alt="npm version" src="https://img.shields.io/npm/v/@promptshield/ignore" />
  </a>
  <a href="https://npmjs.com/package/@promptshield/ignore" rel="noopener noreferrer">
    <img alt="npm downloads" src="https://img.shields.io/npm/d18m/@promptshield/ignore" />
  </a>
  <a href="https://npmjs.com/package/@promptshield/ignore" rel="noopener noreferrer">
    <img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/@promptshield/ignore" />
  </a>
  <img alt="license" src="https://img.shields.io/npm/l/@promptshield/ignore" />
</p>

> **Ignore parser** for PromptShield. Provides file-level and line-level suppression logic for CLI and IDE integrations.

---

## ✨ Features

- **Standard Syntax**: Similar to `eslint-disable` or `ts-ignore`.
- **Granular Control**: Ignore specific lines, blocks, or entire files.
- **File Exclusions**: Supports `.promptshieldignore`, `.psignore`, and `.gitignore`.

---

## 📦 Installation

```bash
$ pnpm add @promptshield/ignore
```

---

## 🚀 Usage

<details>
<summary>Usage examples for inline and file-level ignores</summary>

### In your PROMPTS (or code)

#### Ignore next line

```markdown
<!-- promptshield-ignore -->

I want to use a specific invisible character here: ​
```

#### Ignore block (next N lines)

```markdown
<!-- promptshield-ignore next 5 -->

This block contains highly suspicious
text patterns that are actually
safe in this context.
...
```

#### Ignore entire file

Must be placed in the first 10 lines of the file.

```markdown
<!-- promptshield-ignore all -->

# Suspicious File

...
```

### In `.promptshieldignore`

Add patterns to exclude from scanning completely:

```text
node_modules
dist
**/*.min.js
legacy-prompts/*.txt
```

</details>

> 📚 **Deep Dives**: For advanced ignore semantics (like targeting specific rules e.g., `PSI001`) and reading about **Unused Ignore tracking**, see the [Documentation section](https://promptshield.js.org/docs/ignore).

---

## License

This library is licensed under the MIT open-source license.

<hr />

<p align="center">with 💖 by <a href="https://mayankchaudhari.com" target="_blank">Mayank Kumar Chaudhari</a></p>