Metadata-Version: 2.4
Name: igrep-tme
Version: 0.1.4
Summary: RAG-powered document search — grep meets semantic search
License-Expression: MIT
License-File: LICENSE
Requires-Python: <3.13,>=3.12
Requires-Dist: bm25s>=0.2.0
Requires-Dist: fastapi>=0.115.0
Requires-Dist: html2text>=2024.2.26
Requires-Dist: httpx>=0.27.0
Requires-Dist: huggingface-hub>=0.20.0
Requires-Dist: libsql-experimental>=0.0.50; python_version < '3.14'
Requires-Dist: mcp>=1.0.0
Requires-Dist: nltk>=3.9.0
Requires-Dist: numpy>=1.26.0
Requires-Dist: openai>=1.0.0
Requires-Dist: openpyxl>=3.1.0
Requires-Dist: orjson>=3.11.8
Requires-Dist: pathspec>=0.12.0
Requires-Dist: pillow>=10.0.0
Requires-Dist: pymupdf>=1.24.0
Requires-Dist: python-docx>=1.0.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: python-pptx>=0.6.23
Requires-Dist: rjieba>=0.1.13
Requires-Dist: sqlalchemy-libsql>=0.1.0; python_version < '3.14'
Requires-Dist: sqlmodel>=0.0.22
Requires-Dist: tree-sitter-language-pack>=0.13
Requires-Dist: uvicorn>=0.41.0
Requires-Dist: watchdog>=4.0.0
Requires-Dist: xxhash>=3.5.0
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pyright>=1.1.408; extra == 'dev'
Requires-Dist: pytest-asyncio>=1.3.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.4.0; extra == 'dev'
Provides-Extra: markitdown
Requires-Dist: markitdown>=0.1.0; extra == 'markitdown'
Provides-Extra: mlx
Requires-Dist: huggingface-hub>=0.20.0; extra == 'mlx'
Requires-Dist: mlx-embeddings>=0.0.5; extra == 'mlx'
Requires-Dist: mlx-lm>=0.31.1; extra == 'mlx'
Requires-Dist: mlx-vlm[torch]>=0.4.0; extra == 'mlx'
Requires-Dist: mlx>=0.31.0; extra == 'mlx'
Requires-Dist: safetensors>=0.4.0; extra == 'mlx'
Requires-Dist: vllm-mlx>=0.2.6; extra == 'mlx'
Description-Content-Type: text/markdown

# igrep

面向 Agent 时代的语义搜索工具 —— 像 grep 一样简单，却有RAG 一样的强召回， 还能看懂 PDF、Excel、代码和图片。

**开箱即用，无需建索引**。Local-first，兼容云端 API。

## 特性

- **像 grep 一样用**：零配置直接搜索，支持 glob / 文件类型 / git diff 过滤
- **看懂各种格式**：Markdown、代码、PDF、Excel、PPT、图片 OCR
- **智能语义搜索**：理解自然语言，也精确匹配关键词
- **搜索优先问答**：`igrep ask` 做单次总结；Web / VS Code / Obsidian 提供带引用的 search-first chat
- **开箱即用的集成**：Web、MCP、Obsidian、VS Code、OpenClaw

## 召回性能

公开 benchmark 测试集的 Recall@10 召回率：

| Benchmark | 任务类型 | 召回率 |
|-----------|---------|--------|
| HotpotQA | 多跳问答 | **99%** |
| MuSiQue | 深层多跳问答（2-4 跳）| **73.4%** |
| SWE-bench Verified | 代码文件定位 | **90.5%** |

## 安装

需要 Python >= 3.11。

### 依赖

- **必需**：`ripgrep`
  - macOS：`brew install ripgrep`
  - Linux：`sudo apt install ripgrep`（或 `dnf` / `yum`）

- **必需** `omlx`
  - **推荐**：下载 Mac App → https://omlx.ai/
  - Homebrew：`brew tap jundot/omlx https://github.com/jundot/omlx && brew install omlx`

- **可选**：`libreoffice`（用于 `.doc/.xls/.ppt` 转换）
  - macOS: `brew install --cask libreoffice`
  - Linux: `sudo apt install libreoffice`



### 安装 igrep

```bash
uv tool install --python 3.12 -U igrep-tme
```

TME:
```bash
uv tool install --python 3.12 -U igrep-tme --index-url=https://mirrors.tencent.com/repository/pypi/tencent_pypi/simple --extra-index-url=https://mirrors.tencent.com/pypi/simple/
```

### macOS（Apple Silicon）

```bash
igrep setup
```

### Linux

编辑 `~/.igreprc/.env` 配置 AI 端点：

```bash
IGREP_EMBEDDING_URL=http://your-embed-server/v1   # 必需
IGREP_EMBED_MODEL=your-embed-model
IGREP_LLM_URL=http://your-llm-server/v1           # 推荐
IGREP_RERANK_URL=http://your-rerank-server/v1     # 推荐
```

## 快速开始

```bash
# 搜当前目录
igrep "部署流程"

# 搜指定目录
igrep "query" ~/my-repo

# 只搜 Python 文件
igrep "query" . -g 'src/**/*.py'

# 只搜 git 变更文件
igrep "query" --diff

# 搜索 + LLM 总结（带引用）
igrep ask "部署流程是怎样的" ~/my-repo

# 本地管理台（项目 / 搜索 / 聊天）
igrep serve run
```

## 常用命令

```bash
# 搜索
igrep "query" [path...]              # 默认搜当前目录
igrep "query" . -g 'src/**/*.py'     # 按 glob 过滤（支持 !pattern 排除）
igrep "query" --type md              # 只搜某类文件
igrep "query" --diff [REF]           # 只搜 git 变更文件
igrep "query" -C 5                   # 上下文行数
igrep "query" -m 50                  # 最大结果数
igrep "query" --format json          # JSON 输出

# 搜索 + LLM 总结
igrep ask "query" ~/my-repo          # 自然语言回答，带引用
igrep ask "query" --json             # JSON 输出

# 诊断
igrep doctor
```

## 集成

| 工具 | 命令 |
|------|------|
| Web Control Plane | `igrep serve run` |
| Skill（Claude Code / Codex） | `igrep skill install --target codex` |
| MCP Server（Claude Code / Codex） | `igrep mcp install --target claude` |
| Obsidian | `igrep setup obsidian` |
| VS Code | `igrep setup vscode` |
| OpenClaw | `igrep setup openclaw` |

## License

MIT
