**Motivations:** - Single canonical documentation tree under docs/; reduce drift between README copies. **Evolutions:** - Add docs/repo/ with operational guides (cron, systemd, projects, logs, docv, ia_dev, services, scripts, extension). - Replace scattered README.md files with pointers to docs/repo/*.md. - Refresh docs/README.md index and cross-links across docs/, .cursor rules/agents. - Bump ia_dev submodule to matching doc pointer commits.
42 lines
1.5 KiB
Markdown
42 lines
1.5 KiB
Markdown
# agent-regex-search-api (`services/agent-regex-search-api/`)
|
||
|
||
API HTTP locale sur **`127.0.0.1`** pour la **recherche regex sur fichiers** via [ripgrep](https://github.com/BurntSushi/ripgrep) (`rg`). Approche locale ouverte ; ce n’est pas l’implémentation « instant grep » propriétaire de Cursor.
|
||
|
||
## Prérequis
|
||
|
||
`rg` dans le **`PATH`** (ex. `sudo apt install ripgrep` sur Debian/Ubuntu).
|
||
|
||
## Variables
|
||
|
||
| Variable | Obligatoire | Description |
|
||
|----------|-------------|-------------|
|
||
| `REGEX_SEARCH_TOKEN` | oui | `Authorization: Bearer <token>` (sauf `GET /health`). |
|
||
| `REGEX_SEARCH_ROOT` | non | Répertoire de base absolu (défaut typique `/home/ncantu/code` — à adapter). |
|
||
| `REGEX_SEARCH_HOST` | non | Bind (défaut `127.0.0.1`). |
|
||
| `REGEX_SEARCH_PORT` | non | Port (défaut `37143`). |
|
||
|
||
## Endpoints
|
||
|
||
- `GET /health`
|
||
- `POST /search` — JSON : `pattern`, `subpath` optionnel (relatif à `REGEX_SEARCH_ROOT`, pas de `..`), `maxMatches`, `timeoutMs`
|
||
|
||
Code sortie ripgrep `1` = aucun match → encore **200** avec `matches` vide si pas d’erreur.
|
||
|
||
## Risques
|
||
|
||
**ReDoS** : regex pathologiques jusqu’à `timeoutMs`. **`REGEX_SEARCH_ROOT`** : aligner avec la politique de lecture disque.
|
||
|
||
## Run
|
||
|
||
```bash
|
||
cd services/agent-regex-search-api
|
||
npm install
|
||
npm run build
|
||
export REGEX_SEARCH_TOKEN='…'
|
||
npm start
|
||
```
|
||
|
||
## Spécification
|
||
|
||
[API/agent-regex-search-api.md](../API/agent-regex-search-api.md), [features/agent-regex-search-api.md](../features/agent-regex-search-api.md).
|