# Path set ignore filter

`path-set-ignore-filter` · version 1.0.0 · File paths (lexical) · free, no key needed

Filter paths against gitignore-style rule lines (negation, comments, directory trailing slashes) lexically.

**Use when you need to: gitignore filter · ignore filter paths · apply gitignore rules.**

## Supported

- gitignore filter
- ignore filter paths
- apply gitignore rules

## Not supported

- read .gitignore file
- filesystem access
- stat file

## Behavior

- Blank lines and lines starting with # are comments. Lines starting with ! negate (un-ignore). Trailing / means directory-only match. Patterns are processed in order; later rules override earlier. A path is ignored if the final matching rule is non-negated. kept: not ignored; ignored: are ignored.

## Input

- `paths` (array of string, required): min items 0; max items 10000
- `rules` (array of string, required): min items 0; max items 1024
- `case_sensitive` (boolean, optional)

## Output

- `kept` (array of string, optional)
- `ignored` (array of string, optional)

## Limits

- max paths: 10000
- max rules: 1024
- max path bytes: 4096
- max rule bytes: 512

## Example

Request input:

```json
{
  "paths": [
    "node_modules/pkg/a.js",
    "src/b.ts",
    "dist/c.js"
  ],
  "rules": [
    "node_modules/",
    "dist/"
  ]
}
```

Response:

```json
{
  "result": {
    "kept": [
      "src/b.ts"
    ],
    "ignored": [
      "node_modules/pkg/a.js",
      "dist/c.js"
    ]
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "path-set-ignore-filter",
  "version": "1.0.0",
  "input": {
    "paths": [
      "node_modules/pkg/a.js",
      "src/b.ts",
      "dist/c.js"
    ],
    "rules": [
      "node_modules/",
      "dist/"
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/path-set-ignore-filter/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"paths":["node_modules/pkg/a.js","src/b.ts","dist/c.js"],"rules":["node_modules/","dist/"]}'
```

The machine-readable contract is at [/v1/tools/path-set-ignore-filter/versions/1.0.0](/v1/tools/path-set-ignore-filter/versions/1.0.0).

### CLI

```sh
node cli.mjs run path-set-ignore-filter 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Path set glob filter](/tools/path-set-glob-filter): Filter an array of paths against glob patterns with inclusion and exclusion rules lexically without filesystem access.
- [Path set minimal covering](/tools/path-set-minimal-covering): Find the minimal covering set of paths by collapsing child paths when an ancestor path is already in the set.
- [Path set classify](/tools/path-set-classify): Classify an array of file paths by file extension, depth histogram, and path format.
- [Path set dedupe](/tools/path-set-dedupe): Deduplicate an array of paths based on lexical equivalence while preserving first or last seen order.
- [Path set difference](/tools/path-set-difference): Compute the set difference (A \ B) of two path collections using lexical path equivalence.
- [Path set hierarchy tree](/tools/path-set-hierarchy-tree): Transform a flat array of file paths into a nested deterministic directory tree structure.
