---
description: Suggest important dependencies to add to knowledge stores
allowed-tools: ["Glob", "Read", "mcp__bluera-knowledge__execute", "WebSearch", "AskUserQuestion", "Skill"]
---

# Suggest Dependencies to Index

Analyze project dependencies and suggest important libraries to add to knowledge stores.

## Steps

1. **Find dependency files** using Glob tool:
   - `**/package.json` (JavaScript/TypeScript projects)
   - `**/requirements.txt` (Python projects)
   - `**/go.mod` (Go projects)
   - `**/Cargo.toml` (Rust projects)

2. **Read and parse dependencies**:
   - Use Read tool to read each dependency file
   - Extract package names and usage patterns
   - For package.json: dependencies and devDependencies
   - For requirements.txt: all packages
   - For go.mod: require statements
   - For Cargo.toml: dependencies section

3. **Scan for import statements** using Glob + Read:
   - Find all source files (*.js, *.ts, *.py, *.go, *.rs)
   - Count imports/requires for each dependency
   - Rank dependencies by frequency of use

4. **Select the IMPORTANT dependencies** — not all of them. Apply these criteria:
   - Prioritize core frameworks and libraries the project builds ON (e.g., React, Express, FastAPI)
   - Include libraries with complex APIs where understanding internals helps (e.g., Prisma, Drizzle, Zod)
   - Include deps likely to cause debugging issues or have non-obvious behavior
   - **Skip**: test runners (jest, vitest, pytest), linters (eslint, ruff), formatters (prettier, black), build tools (webpack, vite, esbuild), @types packages, trivial utilities
   - Aim for 5-10 most impactful dependencies, not every dependency

5. **Get existing stores** using mcp__bluera-knowledge__execute with command "stores":
   - Filter out dependencies already in stores
   - Focus on new suggestions

6. **Find repository URLs** using WebSearch:
   - For the selected important dependencies
   - Search for official GitHub/GitLab repositories
   - Prefer official repos over forks

7. **Present selectable list** using AskUserQuestion:

First, show a summary of what was found:
```
## Dependency Analysis

Scanned 342 source files and found 24 dependencies.
Already indexed: typescript, express, jest
```

Then use AskUserQuestion with multiSelect to let the user choose which to add:

```json
{
  "questions": [{
    "question": "Which dependencies would you like to add to your knowledge stores?",
    "header": "Add deps",
    "multiSelect": true,
    "options": [
      {
        "label": "react (Recommended)",
        "description": "147 imports across 52 files - https://github.com/facebook/react"
      },
      {
        "label": "lodash",
        "description": "89 imports across 31 files - https://github.com/lodash/lodash"
      },
      {
        "label": "axios",
        "description": "45 imports across 18 files - https://github.com/axios/axios"
      },
      {
        "label": "zod",
        "description": "32 imports across 12 files - https://github.com/colinhacks/zod"
      }
    ]
  }]
}
```

**Note:** Maximum 4 options per question (AskUserQuestion limit). If more than 4 dependencies, show top 4 and mention others in summary.

8. **Execute selected add-repo commands**:

For each selected dependency, invoke the Skill tool:
```
Skill(skill="bluera-knowledge:add-repo", args="<repo-url> --name=<package-name>")
```

Example for react selection:
```
Skill(skill="bluera-knowledge:add-repo", args="https://github.com/facebook/react --name=react")
```

9. **Show completion summary**:
```
## Added to Knowledge Stores

✓ react - https://github.com/facebook/react
✓ lodash - https://github.com/lodash/lodash

Indexing started. Check progress with /bluera-knowledge:check-status
```

## If No Dependencies Found

```
No external dependencies found in this project.

Make sure you have a dependency manifest file:
- package.json (JavaScript/TypeScript)
- requirements.txt or pyproject.toml (Python)
- go.mod (Go)
- Cargo.toml (Rust)
```

## If User Selects "Other"

If the user types a custom response instead of selecting options, try to parse package names from their input and search for the corresponding repositories.
