Coding & Refactoringlow risk
metagit-workspace-grep
Search on-disk file contents across managed workspace repos via ripgrep (or Python fallback). Use when hunting code strings, configs, or Terraform/Docker patterns — not for manifest metadata.
metagit-ai/metagit-cli·src/metagit/data/skills/metagit-workspace-grep/SKILL.md
85/ 100品質分
匯入這個 Skill
選擇你的 coding agent,複製專案級或個人級安裝指令。
匯入目前專案.agents/skills/metagit-workspace-grep
npx skills add https://github.com/metagit-ai/metagit-cli/tree/482dfb3b7a407ca5e541657a6fcc9af619818243/src/metagit/data/skills/metagit-workspace-grep -a codex -y匯入個人環境~/.agents/skills/metagit-workspace-grep
npx skills add https://github.com/metagit-ai/metagit-cli/tree/482dfb3b7a407ca5e541657a6fcc9af619818243/src/metagit/data/skills/metagit-workspace-grep -a codex -g -y匯入目前專案.claude/skills/metagit-workspace-grep
npx skills add https://github.com/metagit-ai/metagit-cli/tree/482dfb3b7a407ca5e541657a6fcc9af619818243/src/metagit/data/skills/metagit-workspace-grep -a claude-code -y匯入個人環境~/.claude/skills/metagit-workspace-grep
npx skills add https://github.com/metagit-ai/metagit-cli/tree/482dfb3b7a407ca5e541657a6fcc9af619818243/src/metagit/data/skills/metagit-workspace-grep -a claude-code -g -y匯入目前專案.agents/skills/metagit-workspace-grep
npx skills add https://github.com/metagit-ai/metagit-cli/tree/482dfb3b7a407ca5e541657a6fcc9af619818243/src/metagit/data/skills/metagit-workspace-grep -a github-copilot -y匯入個人環境~/.copilot/skills/metagit-workspace-grep
npx skills add https://github.com/metagit-ai/metagit-cli/tree/482dfb3b7a407ca5e541657a6fcc9af619818243/src/metagit/data/skills/metagit-workspace-grep -a github-copilot -g -y匯入目前專案.agents/skills/metagit-workspace-grep
npx skills add https://github.com/metagit-ai/metagit-cli/tree/482dfb3b7a407ca5e541657a6fcc9af619818243/src/metagit/data/skills/metagit-workspace-grep -a cursor -y匯入個人環境~/.cursor/skills/metagit-workspace-grep
npx skills add https://github.com/metagit-ai/metagit-cli/tree/482dfb3b7a407ca5e541657a6fcc9af619818243/src/metagit/data/skills/metagit-workspace-grep -a cursor -g -y匯入目前專案.agents/skills/metagit-workspace-grep
npx skills add https://github.com/metagit-ai/metagit-cli/tree/482dfb3b7a407ca5e541657a6fcc9af619818243/src/metagit/data/skills/metagit-workspace-grep -a gemini-cli -y匯入個人環境~/.gemini/skills/metagit-workspace-grep
npx skills add https://github.com/metagit-ai/metagit-cli/tree/482dfb3b7a407ca5e541657a6fcc9af619818243/src/metagit/data/skills/metagit-workspace-grep -a gemini-cli -g -yNative Gemini CLI
gemini skills install https://github.com/metagit-ai/metagit-cli.git --scope workspace --path src/metagit/data/skills/metagit-workspace-grep⚠ 安裝指令使用開源 skills CLI。執行前請檢查來源、腳本與權限。
Skill 指令
在 GitHub 查看原始檔案 ↗# Workspace content grep
Use this skill when you need **file contents** inside managed repos. Use `metagit search` / `metagit_repo_search` only for **catalog metadata** (names, URLs, tags).
Scaffold paths (`node_modules`, `.venv`, `__pycache__`, `.git`, etc.) are always excluded.
## Modalities (same semantics)
| Modality | Search | Ripgrep / backend status |
|----------|--------|---------------------------|
| CLI | `metagit workspace grep "QUERY" …` | `metagit workspace grep info [--json]` |
| MCP (ACTIVE gate) | `metagit_workspace_search` | `metagit_workspace_grep_info` |
| HTTP (`metagit api serve`) | `GET /v2/workspace/grep?q=…` | `GET /v2/workspace/grep/info` |
| Web UI | Workspace Console → Grep tab | (uses HTTP grep routes) |
## CLI examples
```bash
# whole workspace
metagit workspace grep "DATABASE_URL" --json
# one project
metagit workspace grep 'module "vpc"' --project platform --json
# one repo + context lines
metagit workspace grep "def main" --project portfolio --repo api -C 2 --json
# paths only
metagit workspace grep "TODO" --files-with-matches --limit 50
# backend status (install ripgrep for best performance)
metagit workspace grep info --json
```
Run `metagit workspace grep --help` for the full example list.
## MCP (`metagit_workspace_search`)
Required: `query`. Optional: `repos`, `preset`, `intent`, `paths`, `exclude`, `context_lines`, `include_paths`, `max_results`.
```json
{"query": "DATABASE_URL", "max_results": 25}
{"query": "module", "preset": "terraform", "repos": ["infra/vpc"]}
```
`metagit_workspace_grep_info` — no arguments; returns `ripgrep_available`, `ripgrep_path`, `ripgrep_version`, `search_backend`.
Related: `metagit_workspace_discover` lists files by `intent` or `pattern` (no line content).
## HTTP API
- `GET /v2/workspace/grep?q=…` — optional `project`, `repo` (repeatable), `preset`, `intent`, `max_results`, `context_lines`, `include_paths=true`
- `GET /v2/workspace/grep/info` — ripgrep status JSON
## When not to use
- Manifest / repo discovery → `metagit search` or `metagit_repo_search`
- GitNexus-ranked code flows → `metagit_workspace_semantic_search`