Grepai Workspaces

yoanbernabeu/grepai-skills/skills/advanced/grepai-workspaces

作者 yoanbernabeu382d40261c0d41109c6e11872574ba0be9b064d0无许可证收录于 2026年10月9日更新于 2026年10月9日

Configure multi-project workspaces in GrepAI. Use this skill for monorepos and multiple related projects.

AI 生成的概览

指导配置 GrepAI 工作区,将多个项目归入同一个可搜索索引。

功能
说明如何创建、添加项目、查看、索引、搜索和删除用于归组多个相关项目的 GrepAI 工作区。文档涵盖工作区命令、workspace.yaml 配置文件、按项目过滤搜索,以及为工作区配置 MCP 服务器。还列出 monorepo、微服务和全栈仓库等使用场景,以及常见问题和最佳实践。
适用场景
适用于处理 monorepo、微服务或多个需要一起搜索的相关仓库时。也适合为某一组项目配置限定范围的 GrepAI MCP 服务器。
运行要求
需要 GrepAI 命令行工具及其 workspace、watch、search 和 mcp-serve 命令;需在 workspace.yaml 中配置嵌入模型提供方(如 Ollama)。该技能不附带脚本。

GrepAI Workspaces

This skill covers using GrepAI workspaces to manage multiple related projects with a unified search index.

When to Use This Skill

  • Working with monorepos
  • Searching across multiple related projects
  • Managing microservices architecture
  • Organizing large codebases

What are Workspaces?

Workspaces allow you to:

  • Group multiple projects together
  • Search across all projects at once
  • Or search specific projects within the workspace
  • Share configuration across projects

Creating a Workspace

bash
grepai workspace create my-workspace

Output:

✅ Workspace 'my-workspace' created   Location: ~/.grepai/workspaces/my-workspace/
   Next: Add projects with 'grepai workspace add'

Adding Projects

bash
# Add first projectgrepai workspace add my-workspace /path/to/frontend
# Add more projectsgrepai workspace add my-workspace /path/to/backendgrepai workspace add my-workspace /path/to/shared-lib

Output:

✅ Added '/path/to/frontend' to workspace 'my-workspace'
   Projects in workspace:   1. frontend (/path/to/frontend)
   Run 'grepai watch --workspace my-workspace' to index all projects.

Listing Workspaces

bash
grepai workspace list

Output:

📁 Workspaces
1. my-workspace   - Projects: 3   - Status: Not indexed
2. work-projects   - Projects: 5   - Status: Indexed (updated 2h ago)

Viewing Workspace Details

bash
grepai workspace show my-workspace

Output:

📁 Workspace: my-workspace
Projects:1. frontend   Path: /path/to/frontend   Files: 450   Last indexed: 2025-01-28 10:30
2. backend   Path: /path/to/backend   Files: 320   Last indexed: 2025-01-28 10:30
3. shared-lib   Path: /path/to/shared-lib   Files: 85   Last indexed: 2025-01-28 10:30
Total: 855 files, 4,200 chunks

Indexing a Workspace

bash
# Index all projects in workspacegrepai watch --workspace my-workspace

Output:

🔍 Indexing workspace 'my-workspace'
   [1/3] frontend...         Found 450 files, 2,100 chunks   [2/3] backend...         Found 320 files, 1,500 chunks   [3/3] shared-lib...         Found 85 files, 600 chunks
   Total: 855 files, 4,200 chunks indexed   Watching for changes...

Background Indexing

bash
grepai watch --workspace my-workspace --background

Searching Workspaces

Search All Projects

bash
grepai search --workspace my-workspace "user authentication"

Results include project context:

Score: 0.89 | [backend] src/auth/middleware.go:15-45──────────────────────────────────────────func AuthMiddleware() ...
Score: 0.85 | [frontend] src/hooks/useAuth.ts:10-30──────────────────────────────────────────export function useAuth() ...
Score: 0.78 | [shared-lib] src/types/auth.ts:5-25──────────────────────────────────────────export interface AuthState ...

Search Specific Project

bash
grepai search --workspace my-workspace --project frontend "form validation"

Only searches the frontend project.

Workspace Status

bash
grepai workspace status my-workspace

Output:

📊 Workspace Status: my-workspace
Projects: 3Total files: 855Total chunks: 4,200Index size: 45 MB
Per-project breakdown:┌─────────────┬───────┬────────┬──────────┐│ Project     │ Files │ Chunks │ Updated  │├─────────────┼───────┼────────┼──────────┤│ frontend    │ 450   │ 2,100  │ 2h ago   ││ backend     │ 320   │ 1,500  │ 2h ago   ││ shared-lib  │ 85    │ 600    │ 2h ago   │└─────────────┴───────┴────────┴──────────┘
Daemon: Running (PID 12345)

Removing Projects from Workspace

bash
grepai workspace remove my-workspace /path/to/old-project

Deleting a Workspace

bash
grepai workspace delete my-workspace

This removes the workspace configuration but NOT the project files.

Workspace Configuration

Workspaces store config in ~/.grepai/workspaces/<name>/:

~/.grepai/workspaces/my-workspace/├── workspace.yaml    # Workspace config├── index.gob         # Combined index└── symbols.gob       # Combined symbols

workspace.yaml

yaml
name: my-workspacecreated: 2025-01-28T10:00:00Z
projects:  - name: frontend    path: /path/to/frontend  - name: backend    path: /path/to/backend  - name: shared-lib    path: /path/to/shared-lib
# Optional: override global config per workspaceembedder:  provider: ollama  model: nomic-embed-text
ignore:  - node_modules  - dist

MCP with Workspaces

Use workspaces with MCP servers:

json
{  "mcpServers": {    "grepai": {      "command": "grepai",      "args": ["mcp-serve", "--workspace", "my-workspace"]    }  }}

Use Cases

Monorepo

bash
# Full monorepogrepai workspace create monorepogrepai workspace add monorepo /path/to/monorepo/apps/webgrepai workspace add monorepo /path/to/monorepo/apps/mobilegrepai workspace add monorepo /path/to/monorepo/packages/uigrepai workspace add monorepo /path/to/monorepo/packages/core

Microservices

bash
# Related microservicesgrepai workspace create servicesgrepai workspace add services /path/to/user-servicegrepai workspace add services /path/to/order-servicegrepai workspace add services /path/to/payment-servicegrepai workspace add services /path/to/notification-service

Frontend + Backend

bash
# Full stackgrepai workspace create fullstackgrepai workspace add fullstack /path/to/frontendgrepai workspace add fullstack /path/to/backendgrepai workspace add fullstack /path/to/shared-types

Cross-Project Search Examples

Find All API Endpoints

bash
grepai search --workspace services "REST API endpoint handler"

Find Shared Type Usage

bash
grepai search --workspace fullstack "User interface definition"

Find Cross-Project Dependencies

bash
# What calls the shared auth library?grepai trace callers --workspace fullstack "validateToken"

Best Practices

  1. Name descriptively: ecommerce-stack not ws1
  2. Group related projects: Only projects that you'd search together
  3. One daemon per workspace: Run grepai watch --workspace
  4. Use project filter: When you know which project to search
  5. Update after major changes: Re-index after adding/removing files

Common Issues

❌ Problem: Workspace not found ✅ Solution: Check workspace exists: grepai workspace list

❌ Problem: Project paths changed ✅ Solution: Remove old path, add new path:

bash
grepai workspace remove my-workspace /old/pathgrepai workspace add my-workspace /new/path

❌ Problem: Search returns mixed results ✅ Solution: Use --project flag to filter:

bash
grepai search --workspace ws --project backend "query"

Output Format

Workspace overview:

📁 Workspace: my-workspace
Configuration:- Location: ~/.grepai/workspaces/my-workspace/- Created: 2025-01-28
Projects (3):┌─────────────┬──────────────────────────┬───────┐│ Name        │ Path                      │ Files │├─────────────┼──────────────────────────┼───────┤│ frontend    │ /path/to/frontend        │ 450   ││ backend     │ /path/to/backend         │ 320   ││ shared-lib  │ /path/to/shared-lib      │ 85    │└─────────────┴──────────────────────────┴───────┘
Commands:- Index: grepai watch --workspace my-workspace- Search: grepai search --workspace my-workspace "query"- Status: grepai workspace status my-workspace

来源与署名

来源:yoanbernabeu/grepai-skills位于skills/advanced/grepai-workspaces提交382d402

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架