# Path set minimal covering

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

Find the minimal covering set of paths by collapsing child paths when an ancestor path is already in the set.

**Use when you need to: minimal covering set · collapse redundant paths · ancestor path filter.**

## Supported

- minimal covering set
- collapse redundant paths
- ancestor path filter

## Not supported

- stat file
- filesystem access

## Behavior

- Remove any path that is a descendant of another path already in the set. covering: minimal subset such that every original path is either in covering or is a descendant of a path in covering. removed: count of removed redundant paths. Paths in covering maintain their relative input order.

## Input

- `paths` (array of string, required): min items 0; max items 10000
- `format` (one of "posix", "windows", "auto", optional)

## Output

- `covering` (array of string, optional)
- `removed` (integer, optional)
- `format` (string, optional)

## Limits

- max paths: 10000
- max path bytes: 4096

## Example

Request input:

```json
{
  "paths": [
    "/app",
    "/app/src",
    "/app/src/index.ts",
    "/other/file.ts"
  ]
}
```

Response:

```json
{
  "result": {
    "covering": [
      "/app",
      "/other/file.ts"
    ],
    "removed": 2,
    "format": "posix"
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "path-set-minimal-covering",
  "version": "1.0.0",
  "input": {
    "paths": [
      "/app",
      "/app/src",
      "/app/src/index.ts",
      "/other/file.ts"
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/path-set-minimal-covering/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"paths":["/app","/app/src","/app/src/index.ts","/other/file.ts"]}'
```

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

### CLI

```sh
node cli.mjs run path-set-minimal-covering 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 ignore filter](/tools/path-set-ignore-filter): Filter paths against gitignore-style rule lines (negation, comments, directory trailing slashes) lexically.
- [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.
