# pi-rg

Pi package that adds a `/r` command with cached ripgrep-backed file completions and inserts `@file` references into the editor.

## Why

Pi's built-in `@` file autocomplete is convenient, but on larger repositories it can feel slower than a ripgrep-backed file index. This package adds a dedicated `/r` flow that uses a cached `rg --files` result for command completions, which makes file lookup feel much snappier in big codebases.

The goal is not to replace `@`, but to provide a faster path when you already know you want to search for a file and insert it as an `@file` reference.

## Usage

Install with pi:

```bash
pi install npm:@javimolina/pi-rg
```

Or with the installer:

```bash
npx @javimolina/pi-rg
```

If pi is already running, use:

```text
/reload
```

Then type:

```text
/r tui
```

While typing, pi shows live command completions from a cached `rg --files` index.

When you submit:
- if there is one exact or best remaining match, it inserts `@path/to/file`
- if there are multiple matches, it opens a selector
- if there are no matches, it shows a notification

The inserted text replaces the `/r ...` command line with:

```text
@path/to/file
```
