{{include:repoix-discovery-base.md}}

## Quick Reference by Mode

| Task | MCP (DISCOVERY_MODE=mcp) | CLI (DISCOVERY_MODE=cli) |
|------|--------------------------|--------------------------|
| Test recommendations | `tests(action="recommended", changed_files=[...])` | `civyk-repoix query tests --action recommended --changed-files "f1,f2"` |
| Find existing tests | `tests(action="for_file", path="src/auth.py")` | `civyk-repoix query tests --action for_file --path "src/auth.py"` |
| Find untested code | `quality(action="dead_code", limit=20)` | `civyk-repoix query quality --action dead_code --limit 20` |
| High-risk files | `git(action="hotspots", since="30d")` | `civyk-repoix query git --action hotspots --since 30d` |
| File structure | `file(action="symbols", path="...")` | `civyk-repoix query file --action symbols --path "..."` |
| Dependencies | `symbol(action="callers", fqn="...", depth=2)` | `civyk-repoix query symbol --action callers --fqn "..." --depth 2` |
| Similar code | `quality(action="duplicates", source_only=true)` | `civyk-repoix query quality --action duplicates --source-only true` |

---

## Primary Test Discovery Tools

### 1. Get Recommended Tests (Priority Tool)

**Use for changed files to identify which tests to run/create:**

```text
# MCP
tests(action="recommended", changed_files=["src/auth/login.py", "src/auth/session.py"])

# CLI
civyk-repoix query tests --action recommended --changed-files "src/auth/login.py,src/auth/session.py"
```

Returns: existing tests covering the changes, gaps needing new tests, priority ranking.

### 2. Get Tests For File

**Find existing tests for a specific file:**

```text
# MCP
tests(action="for_file", path="src/services/payment.py")

# CLI
civyk-repoix query tests --action for_file --path "src/services/payment.py"
```

### 3. Get Dead Code (Untested/Unreachable)

**Identify code that may need tests:**

```text
# MCP
quality(action="dead_code", limit=30)

# CLI
civyk-repoix query quality --action dead_code --limit 30
```

### 4. Get Hotspots (High-Risk Areas)

**Files frequently changed = higher test priority:**

```text
# MCP
git(action="hotspots", since="30d", limit=20)

# CLI
civyk-repoix query git --action hotspots --since 30d --limit 20
```

---

## First-Time Orientation

```text
# 1. Quick architecture overview (use mode-appropriate call)
architecture(action="components")
architecture(action="endpoints", kind="class", limit=20)

# 2. Understand test patterns and coverage
context(action="task", task="understand test structure and patterns", token_budget=1500, prefer_kinds=["class", "function"])
```

---

## Full CLI Conversion Reference

| MCP | CLI |
|-----|-----|
| `status(action="check")` | `civyk-repoix query status --action check` |
| `tests(action="recommended", changed_files=[...])` | `civyk-repoix query tests --action recommended --changed-files "f1,f2"` |
| `tests(action="for_file", path="...")` | `civyk-repoix query tests --action for_file --path "..."` |
| `tests(action="code_for_test", path="...")` | `civyk-repoix query tests --action code_for_test --path "..."` |
| `architecture(action="components")` | `civyk-repoix query architecture --action components` |
| `architecture(action="endpoints", limit=N)` | `civyk-repoix query architecture --action endpoints --limit N` |
| `context(action="task", task="...", token_budget=N)` | `civyk-repoix query context --action task --task "..." --token-budget N` |
| `files(pattern="...")` | `civyk-repoix query files --pattern "..."` |
| `quality(action="dead_code", limit=N)` | `civyk-repoix query quality --action dead_code --limit N` |
| `git(action="hotspots", since="30d")` | `civyk-repoix query git --action hotspots --since 30d` |
| `git(action="changes", since="7d", include_symbols=true)` | `civyk-repoix query git --action changes --since 7d --include-symbols true` |
| `file(action="symbols", path="...")` | `civyk-repoix query file --action symbols --path "..."` |
| `file(action="imports", path="...")` | `civyk-repoix query file --action imports --path "..."` |
| `symbol(action="callers", fqn="...", depth=N)` | `civyk-repoix query symbol --action callers --fqn "..." --depth N` |
| `symbol(action="detail", fqn="...")` | `civyk-repoix query symbol --action detail --fqn "..."` |
| `quality(action="duplicates", source_only=true)` | `civyk-repoix query quality --action duplicates --source-only true` |
| `quality(action="impact", fqn="...", depth=N)` | `civyk-repoix query quality --action impact --fqn "..." --depth N` |
| `search(action="symbols", query="...", kind="...")` | `civyk-repoix query search --action symbols --query "..." --kind "..."` |
