smart_ide/docs/repo/service-agent-regex-search.md
Nicolas Cantu ac96434351 docs: centralize README content under docs/repo/
**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.
2026-04-03 18:20:31 +02:00

42 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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 nest pas limplé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 derreur.
## 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).