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 を選び、プロジェクト用または個人用コマンドをコピーします。

収録 commit に固定
プロジェクトに導入.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
手動配置先.agents/skills/metagit-workspace-grepOfficial docs ↗
プロジェクトに導入.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
手動配置先.claude/skills/metagit-workspace-grepOfficial docs ↗
プロジェクトに導入.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-grepOfficial docs ↗
プロジェクトに導入.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-grepOfficial docs ↗
プロジェクトに導入.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 -y
Native Gemini CLIgemini skills install https://github.com/metagit-ai/metagit-cli.git --scope workspace --path src/metagit/data/skills/metagit-workspace-grep
手動配置先.agents/skills/metagit-workspace-grepOfficial docs ↗
⚠ インストールには open-source skills CLI を使用します。実行前にソースと権限を確認してください。
# 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`