grepai-watch-daemon by yoanbernabeu/grepai-skills
npx skills add https://github.com/yoanbernabeu/grepai-skills --skill grepai-watch-daemon本技能涵盖 grepai watch 命令和用于实时代码索引的守护进程管理。
监控守护进程:
cd /your/project
grepai watch
输出:
🔍 GrepAI Watch
正在扫描文件...
找到 245 个文件
正在处理代码块...
████████████████████████████████ 100%
已索引 1,234 个代码块
正在监控变更...
按 Ctrl+C 停止。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
grepai watch --background
输出:
🔍 GrepAI Watch (background)
守护进程已启动,PID 12345
日志文件:~/.grepai/daemon.log
grepai watch --status
输出:
✅ GrepAI 守护进程正在运行
PID:12345
启动时间:2025-01-28 10:30:00
项目:/path/to/project
统计信息:
- 已索引文件:245
- 代码块:1,234
- 上次更新:2 分钟前
grepai watch --stop
输出:
✅ 守护进程已停止 (PID 12345)
| 命令 | 描述 |
|---|---|
grepai watch | 在前台启动守护进程 |
grepai watch --background | 在后台启动守护进程 |
grepai watch --status | 检查守护进程状态 |
grepai watch --stop | 停止正在运行的守护进程 |
# .grepai/config.yaml
watch:
# 防抖延迟(毫秒)
# 将快速的文件变更分组处理
debounce_ms: 500
当您保存文件时,编辑器通常会快速写入多次。防抖功能会等待变更稳定下来:
| 值 | 行为 |
|---|---|
100 | 响应更快,重新索引更频繁 |
500 | 平衡(默认值) |
1000 | 响应较慢,重新索引较少 |
守护进程索引以下文件:
.gitignore大型代码库会显示进度:
正在扫描文件...
找到 10,245 个文件
正在处理代码块...
████████████████░░░░░░░░░░░░░░░░ 50% (5,122/10,245)
| 代码库规模 | 文件数 | 时间 (Ollama) | 时间 (OpenAI) |
|---|---|---|---|
| 小型 | 100 | ~30秒 | ~10秒 |
| 中型 | 1,000 | ~5分钟 | ~1分钟 |
| 大型 | 10,000 | ~30分钟 | ~5分钟 |
初始索引完成后,守护进程监控以下事件:
使用操作系统原生的文件监控:
| 操作 | 结果 |
|---|---|
| 保存现有文件 | 重新嵌入文件代码块 |
| 创建新文件 | 索引新代码块 |
| 删除文件 | 从索引中移除 |
| 重命名文件 | 更新路径,保留向量 |
创建 ~/Library/LaunchAgents/com.grepai.watch.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.grepai.watch</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/grepai</string>
<string>watch</string>
</array>
<key>WorkingDirectory</key>
<string>/path/to/your/project</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
加载:
launchctl load ~/Library/LaunchAgents/com.grepai.watch.plist
创建 ~/.config/systemd/user/grepai-watch.service:
[Unit]
Description=GrepAI Watch Daemon
After=network.target
[Service]
Type=simple
WorkingDirectory=/path/to/your/project
ExecStart=/usr/local/bin/grepai watch
Restart=always
[Install]
WantedBy=default.target
启用:
systemctl --user enable grepai-watch
systemctl --user start grepai-watch
# 后台守护进程日志
tail -f ~/.grepai/daemon.log
# 或者使用 systemd
journalctl --user -u grepai-watch -f
为每个项目运行独立的守护进程:
# 终端 1:项目 A
cd /path/to/project-a
grepai watch --background
# 终端 2:项目 B
cd /path/to/project-b
grepai watch --background
适用于多项目设置:
grepai workspace create my-workspace
grepai workspace add my-workspace /path/to/project-a
grepai workspace add my-workspace /path/to/project-b
grepai watch --workspace my-workspace
❌ 问题: "另一个守护进程已在运行" ✅ 解决方案:
grepai watch --stop
grepai watch --background
❌ 问题: "未找到配置" ✅ 解决方案: 先初始化:
grepai init
grepai watch
❌ 问题: "嵌入器连接失败" ✅ 解决方案: 启动您的嵌入向量提供程序:
ollama serve # 对于 Ollama
❌ 问题: 文件未被索引 ✅ 解决方案: 检查配置中的忽略模式,确保文件扩展名受支持
❌ 问题: 索引速度非常慢 ✅ 解决方案:
❌ 问题: 索引似乎已过时 ✅ 解决方案: 清除并重新索引:
rm .grepai/index.gob
grepai watch
❌ 问题: 变更未被检测到 ✅ 解决方案:
减小 debounce_ms
检查 inotify 限制 (Linux):
echo 65536 | sudo tee /proc/sys/fs/inotify/max_user_watches
定期健康检查:
grepai status
输出:
✅ GrepAI 状态
项目:/path/to/project
配置:.grepai/config.yaml
嵌入器:Ollama (nomic-embed-text)
存储:GOB (.grepai/index.gob)
索引:
- 文件:245
- 代码块:1,234
- 大小:12.5 MB
- 上次更新:2025-01-28 10:30:00
守护进程:正在运行 (PID 12345)
监控守护进程状态:
✅ 监控守护进程活跃
模式:后台
PID:12345
项目:/path/to/project
初始索引:
- 已扫描文件:245
- 已创建代码块:1,234
- 耗时:45秒
实时监控器:
- 防抖:500毫秒
- 已处理事件:23
- 上次事件:5 分钟前
后续步骤:
- 运行 'grepai search "query"' 进行搜索
- 运行 'grepai watch --status' 检查状态
- 运行 'grepai watch --stop' 停止守护进程
每周安装次数
263
仓库
GitHub 星标数
15
首次出现
2026年1月28日
安全审计
安装于
opencode213
codex207
gemini-cli191
github-copilot190
kimi-cli177
amp175
This skill covers the grepai watch command and daemon management for real-time code indexing.
The watch daemon:
cd /your/project
grepai watch
Output:
🔍 GrepAI Watch
Scanning files...
Found 245 files
Processing chunks...
████████████████████████████████ 100%
Indexed 1,234 chunks
Watching for changes...
Press Ctrl+C to stop.
grepai watch --background
Output:
🔍 GrepAI Watch (background)
Daemon started with PID 12345
Log file: ~/.grepai/daemon.log
grepai watch --status
Output:
✅ GrepAI Daemon Running
PID: 12345
Started: 2025-01-28 10:30:00
Project: /path/to/project
Statistics:
- Files indexed: 245
- Chunks: 1,234
- Last update: 2 minutes ago
grepai watch --stop
Output:
✅ Daemon stopped (PID 12345)
| Command | Description |
|---|---|
grepai watch | Start daemon in foreground |
grepai watch --background | Start daemon in background |
grepai watch --status | Check daemon status |
grepai watch --stop | Stop running daemon |
# .grepai/config.yaml
watch:
# Debounce delay in milliseconds
# Groups rapid file changes together
debounce_ms: 500
When you save a file, editors often write multiple times quickly. Debouncing waits for changes to settle:
| Value | Behavior |
|---|---|
100 | More responsive, more reindexing |
500 | Balanced (default) |
1000 | Less responsive, fewer reindexing |
The daemon indexes files:
.gitignoreLarge codebases show progress:
Scanning files...
Found 10,245 files
Processing chunks...
████████████████░░░░░░░░░░░░░░░░ 50% (5,122/10,245)
| Codebase | Files | Time (Ollama) | Time (OpenAI) |
|---|---|---|---|
| Small | 100 | ~30s | ~10s |
| Medium | 1,000 | ~5min | ~1min |
| Large | 10,000 | ~30min | ~5min |
After initial indexing, the daemon watches for:
Uses OS-native file watching:
| Action | Result |
|---|---|
| Save existing file | Re-embed file chunks |
| Create new file | Index new chunks |
| Delete file | Remove from index |
| Rename file | Update path, keep vectors |
Create ~/Library/LaunchAgents/com.grepai.watch.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.grepai.watch</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/grepai</string>
<string>watch</string>
</array>
<key>WorkingDirectory</key>
<string>/path/to/your/project</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
Load:
launchctl load ~/Library/LaunchAgents/com.grepai.watch.plist
Create ~/.config/systemd/user/grepai-watch.service:
[Unit]
Description=GrepAI Watch Daemon
After=network.target
[Service]
Type=simple
WorkingDirectory=/path/to/your/project
ExecStart=/usr/local/bin/grepai watch
Restart=always
[Install]
WantedBy=default.target
Enable:
systemctl --user enable grepai-watch
systemctl --user start grepai-watch
# Background daemon logs
tail -f ~/.grepai/daemon.log
# Or with systemd
journalctl --user -u grepai-watch -f
Run separate daemons for each project:
# Terminal 1: Project A
cd /path/to/project-a
grepai watch --background
# Terminal 2: Project B
cd /path/to/project-b
grepai watch --background
For multi-project setups:
grepai workspace create my-workspace
grepai workspace add my-workspace /path/to/project-a
grepai workspace add my-workspace /path/to/project-b
grepai watch --workspace my-workspace
❌ Problem: "Another daemon is already running" ✅ Solution:
grepai watch --stop
grepai watch --background
❌ Problem: "Config not found" ✅ Solution: Initialize first:
grepai init
grepai watch
❌ Problem: "Embedder connection failed" ✅ Solution: Start your embedding provider:
ollama serve # For Ollama
❌ Problem: Files not being indexed ✅ Solution: Check ignore patterns in config, ensure file extension is supported
❌ Problem: Indexing very slow ✅ Solutions:
❌ Problem: Index seems outdated ✅ Solution: Clear and reindex:
rm .grepai/index.gob
grepai watch
❌ Problem: Changes not detected ✅ Solutions:
Reduce debounce_ms
Check inotify limits (Linux):
echo 65536 | sudo tee /proc/sys/fs/inotify/max_user_watches
Regular health check:
grepai status
Output:
✅ GrepAI Status
Project: /path/to/project
Config: .grepai/config.yaml
Embedder: Ollama (nomic-embed-text)
Storage: GOB (.grepai/index.gob)
Index:
- Files: 245
- Chunks: 1,234
- Size: 12.5 MB
- Last updated: 2025-01-28 10:30:00
Daemon: Running (PID 12345)
Watch daemon status:
✅ Watch Daemon Active
Mode: Background
PID: 12345
Project: /path/to/project
Initial Index:
- Files scanned: 245
- Chunks created: 1,234
- Duration: 45s
Real-time Monitor:
- Debounce: 500ms
- Events processed: 23
- Last event: 5 minutes ago
Next steps:
- Run 'grepai search "query"' to search
- Run 'grepai watch --status' to check status
- Run 'grepai watch --stop' to stop daemon
Weekly Installs
263
Repository
GitHub Stars
15
First Seen
Jan 28, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykWarn
Installed on
opencode213
codex207
gemini-cli191
github-copilot190
kimi-cli177
amp175
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
140,500 周安装
竞争对手研究指南:SEO、内容、反向链接与定价分析工具
231 周安装
Azure 工作负载自动升级评估工具 - 支持 Functions、App Service 计划与 SKU 迁移
231 周安装
Kaizen持续改进方法论:软件开发中的渐进式优化与防错设计实践指南
231 周安装
软件UI/UX设计指南:以用户为中心的设计原则、WCAG可访问性与平台规范
231 周安装
Apify 网络爬虫和自动化平台 - 无需编码抓取亚马逊、谷歌、领英等网站数据
231 周安装
llama.cpp 中文指南:纯 C/C++ LLM 推理,CPU/非 NVIDIA 硬件优化部署
231 周安装