grepai-quickstart
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGrepAI Quickstart
GrepAI 快速入门
This skill provides a complete walkthrough to get GrepAI running and searching your code in 5 minutes.
本指南提供完整流程,帮助你在5分钟内启动GrepAI并搜索你的代码。
When to Use This Skill
何时使用本指南
- First time using GrepAI
- Need a quick refresher on basic workflow
- Setting up GrepAI on a new project
- Demonstrating GrepAI to someone
- 首次使用GrepAI
- 需要快速回顾基础工作流程
- 在新项目中配置GrepAI
- 向他人演示GrepAI
Prerequisites
前置要求
- Terminal access
- A code project to index
- 终端访问权限
- 一个需要索引的代码项目
Step 1: Install GrepAI
步骤1:安装GrepAI
macOS
macOS
bash
brew install yoanbernabeu/tap/grepaibash
brew install yoanbernabeu/tap/grepaiLinux/macOS (Alternative)
Linux/macOS(替代方案)
bash
curl -sSL https://raw.githubusercontent.com/yoanbernabeu/grepai/main/install.sh | shbash
curl -sSL https://raw.githubusercontent.com/yoanbernabeu/grepai/main/install.sh | shWindows
Windows
powershell
irm https://raw.githubusercontent.com/yoanbernabeu/grepai/main/install.ps1 | iexVerify:
grepai versionpowershell
irm https://raw.githubusercontent.com/yoanbernabeu/grepai/main/install.ps1 | iex验证:
grepai versionStep 2: Install Ollama (Local Embeddings)
步骤2:安装Ollama(本地嵌入模型)
macOS
macOS
bash
brew install ollama
ollama serve &
ollama pull nomic-embed-textbash
brew install ollama
ollama serve &
ollama pull nomic-embed-textLinux
Linux
bash
curl -fsSL https://ollama.com/install.sh | sh
ollama serve &
ollama pull nomic-embed-textVerify:
curl http://localhost:11434/api/tagsbash
curl -fsSL https://ollama.com/install.sh | sh
ollama serve &
ollama pull nomic-embed-text验证:
curl http://localhost:11434/api/tagsStep 3: Initialize Your Project
步骤3:初始化你的项目
Navigate to your project and initialize GrepAI:
bash
cd /path/to/your/project
grepai initThis creates with default settings:
.grepai/config.yaml- Ollama as embedding provider
- model
nomic-embed-text - GOB file storage
- Standard ignore patterns
导航到你的项目并初始化GrepAI:
bash
cd /path/to/your/project
grepai init这会创建 文件,包含默认设置:
.grepai/config.yaml- 使用Ollama作为嵌入模型提供商
- 模型
nomic-embed-text - GOB文件存储
- 标准忽略规则
Step 4: Start Indexing
步骤4:开始索引
Start the watch daemon to index your code:
bash
grepai watchWhat happens:
- Scans all source files (respects )
.gitignore - Chunks code into ~512 token segments
- Generates embeddings via Ollama
- Stores vectors in
.grepai/index.gob
First indexing output:
🔍 GrepAI Watch
Scanning files...
Found 245 files
Processing chunks...
████████████████████████████████ 100%
Indexed 1,234 chunks
Watching for changes...启动监控守护进程以索引你的代码:
bash
grepai watch执行过程:
- 扫描所有源文件(遵循 规则)
.gitignore - 将代码分割为约512个token的片段
- 通过Ollama生成嵌入向量
- 将向量存储在 中
.grepai/index.gob
首次索引输出示例:
🔍 GrepAI Watch
Scanning files...
Found 245 files
Processing chunks...
████████████████████████████████ 100%
Indexed 1,234 chunks
Watching for changes...Background Mode
后台模式
For long-running projects:
bash
undefined针对长期运行的项目:
bash
undefinedStart in background
后台启动
grepai watch --background
grepai watch --background
Check status
检查状态
grepai watch --status
grepai watch --status
Stop when done
停止进程
grepai watch --stop
undefinedgrepai watch --stop
undefinedStep 5: Search Your Code
步骤5:搜索你的代码
Now search semantically:
bash
undefined现在进行语义搜索:
bash
undefinedBasic search
基础搜索
grepai search "authentication flow"
grepai search "authentication flow"
Limit results
限制结果数量
grepai search "error handling" --limit 5
grepai search "error handling" --limit 5
JSON output for scripts
输出JSON格式用于脚本
grepai search "database queries" --json
undefinedgrepai search "database queries" --json
undefinedExample Output
示例输出
Score: 0.89 | src/auth/middleware.go:15-45
──────────────────────────────────────────
func AuthMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
token := c.GetHeader("Authorization")
if token == "" {
c.AbortWithStatus(401)
return
}
// Validate JWT token...
}
}
Score: 0.82 | src/auth/jwt.go:23-55
──────────────────────────────────────────
func ValidateToken(tokenString string) (*Claims, error) {
token, err := jwt.Parse(tokenString, func(t *jwt.Token) (interface{}, error) {
return []byte(secretKey), nil
})
// ...
}Score: 0.89 | src/auth/middleware.go:15-45
──────────────────────────────────────────
func AuthMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
token := c.GetHeader("Authorization")
if token == "" {
c.AbortWithStatus(401)
return
}
// Validate JWT token...
}
}
Score: 0.82 | src/auth/jwt.go:23-55
──────────────────────────────────────────
func ValidateToken(tokenString string) (*Claims, error) {
token, err := jwt.Parse(tokenString, func(t *jwt.Token) (interface{}, error) {
return []byte(secretKey), nil
})
// ...
}Step 6: Analyze Call Graphs (Optional)
步骤6:分析调用图(可选)
Trace function relationships:
bash
undefined追踪函数关系:
bash
undefinedWho calls this function?
哪些函数调用了该函数?
grepai trace callers "Login"
grepai trace callers "Login"
What does this function call?
该函数调用了哪些函数?
grepai trace callees "ProcessPayment"
grepai trace callees "ProcessPayment"
Full dependency graph
完整依赖图
grepai trace graph "ValidateToken" --depth 3
undefinedgrepai trace graph "ValidateToken" --depth 3
undefinedComplete Workflow Summary
完整工作流程总结
bash
undefinedbash
undefined1. Install (once)
1. 安装(仅需一次)
brew install yoanbernabeu/tap/grepai
brew install ollama && ollama serve & && ollama pull nomic-embed-text
brew install yoanbernabeu/tap/grepai
brew install ollama && ollama serve & && ollama pull nomic-embed-text
2. Setup project (once per project)
2. 项目配置(每个项目仅需一次)
cd /your/project
grepai init
cd /your/project
grepai init
3. Index (run in background)
3. 启动索引(后台运行)
grepai watch --background
grepai watch --background
4. Search (as needed)
4. 搜索(按需使用)
grepai search "your query here"
grepai search "your query here"
5. Trace (as needed)
5. 追踪(按需使用)
grepai trace callers "FunctionName"
undefinedgrepai trace callers "FunctionName"
undefinedQuick Command Reference
快速命令参考
| Command | Purpose |
|---|---|
| Initialize project config |
| Start indexing daemon |
| Run daemon in background |
| Check daemon status |
| Stop daemon |
| Semantic search |
| JSON output |
| Find callers |
| Find callees |
| Index statistics |
| Show version |
| 命令 | 用途 |
|---|---|
| 初始化项目配置 |
| 启动索引守护进程 |
| 后台运行守护进程 |
| 检查守护进程状态 |
| 停止守护进程 |
| 语义搜索 |
| 输出JSON格式结果 |
| 查找调用方 |
| 查找被调用方 |
| 查看索引统计信息 |
| 显示版本信息 |
Search Tips
搜索技巧
Be descriptive, not literal:
- ✅ "user authentication and session management"
- ❌ "auth"
Describe intent:
- ✅ "where errors are logged to the console"
- ❌ "console.error"
Use English:
- Models are trained primarily on English text
- Works best with English queries
描述性而非字面化:
- ✅ "user authentication and session management"
- ❌ "auth"
描述意图:
- ✅ "where errors are logged to the console"
- ❌ "console.error"
使用英文:
- 模型主要基于英文文本训练
- 英文查询效果最佳
Next Steps
后续步骤
After mastering the basics:
- Configure embeddings: See skills
grepai-embeddings-* - Setup storage: See skills
grepai-storage-* - Advanced search: See skills
grepai-search-* - MCP integration: See skills
grepai-mcp-*
掌握基础操作后:
- 配置嵌入模型: 查看 相关指南
grepai-embeddings-* - 配置存储: 查看 相关指南
grepai-storage-* - 高级搜索: 查看 相关指南
grepai-search-* - MCP集成: 查看 相关指南
grepai-mcp-*
Output Format
输出格式
Successful quickstart:
✅ GrepAI Quickstart Complete
Project: /path/to/your/project
Files indexed: 245
Chunks created: 1,234
Embedder: Ollama (nomic-embed-text)
Storage: GOB (local file)
Try these searches:
- grepai search "main entry point"
- grepai search "database connection"
- grepai search "error handling"快速入门成功完成后:
✅ GrepAI Quickstart Complete
Project: /path/to/your/project
Files indexed: 245
Chunks created: 1,234
Embedder: Ollama (nomic-embed-text)
Storage: GOB (local file)
Try these searches:
- grepai search "main entry point"
- grepai search "database connection"
- grepai search "error handling"