octocode-cli 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -93
- package/out/octocode-cli.js +9818 -1626
- package/package.json +15 -5
- package/skills/README.md +121 -0
- package/skills/octocode-generate/SKILL.md +166 -0
- package/skills/octocode-plan/SKILL.md +166 -0
- package/skills/octocode-pr-review/SKILL.md +137 -0
- package/skills/octocode-research/SKILL.md +177 -0
- package/skills/octocode-research/references/tool-reference.md +304 -0
- package/skills/octocode-research/references/workflow-patterns.md +325 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: octocode-research
|
|
3
|
+
description: Answers questions about codebases, implementations, dependencies, or bugs using evidence from actual code. Use when researching code, debugging issues, understanding implementations, tracing dependencies, or exploring unfamiliar codebases.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Octocode Research
|
|
7
|
+
|
|
8
|
+
Evidence-first code forensics using Octocode MCP tools.
|
|
9
|
+
|
|
10
|
+
## The Iron Laws
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
NO CONCLUSIONS WITHOUT CODE EVIDENCE
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
1. **Code is Truth**: Comments, docs, and variable names lie. Only implementation logic is truth.
|
|
17
|
+
2. **Validate Findings**: Cross-reference findings. Check updated dates (avoid >1yr stale).
|
|
18
|
+
3. **Follow Hints**: Every tool returns hints - follow them. Empty results = wrong query → try semantic variants.
|
|
19
|
+
|
|
20
|
+
## When to Use
|
|
21
|
+
|
|
22
|
+
Use for ANY question about code:
|
|
23
|
+
- "How does auth work?"
|
|
24
|
+
- "Where is the API defined?"
|
|
25
|
+
- "Why did this break?"
|
|
26
|
+
- "What dependencies does X use?"
|
|
27
|
+
|
|
28
|
+
## Tools
|
|
29
|
+
|
|
30
|
+
**GitHub Tools**:
|
|
31
|
+
| Tool | Purpose |
|
|
32
|
+
|------|---------|
|
|
33
|
+
| `packageSearch` | Package metadata, versions, repo location |
|
|
34
|
+
| `githubSearchRepositories` | Discover repos by topics, stars, activity |
|
|
35
|
+
| `githubViewRepoStructure` | Explore directory layout and file sizes |
|
|
36
|
+
| `githubSearchCode` | Find patterns, implementations, file paths |
|
|
37
|
+
| `githubGetFileContent` | Read file content with `matchString` targeting |
|
|
38
|
+
| `githubSearchPullRequests` | Fetch PR metadata, diffs, comments, history |
|
|
39
|
+
|
|
40
|
+
**Local Tools**:
|
|
41
|
+
| Tool | Purpose | Replaces |
|
|
42
|
+
|------|---------|----------|
|
|
43
|
+
| `localViewStructure` | Explore directories with sorting/depth/filtering | `ls`, `tree` |
|
|
44
|
+
| `localSearchCode` | Fast content search with pagination & hints | `grep`, `rg` |
|
|
45
|
+
| `localFindFiles` | Find files by metadata (name/time/size) | `find` |
|
|
46
|
+
| `localGetFileContent` | Read file content with targeting & context | `cat`, `head` |
|
|
47
|
+
|
|
48
|
+
## Local-First Strategy
|
|
49
|
+
|
|
50
|
+
**ALWAYS prefer local tools over shell commands** for workspace exploration:
|
|
51
|
+
|
|
52
|
+
| Instead of... | Use... | Why Better |
|
|
53
|
+
|---------------|--------|------------|
|
|
54
|
+
| `grep`, `rg` | `localSearchCode` | Structured results, pagination, hints, byte offsets |
|
|
55
|
+
| `ls`, `tree` | `localViewStructure` | Filtering, sorting, depth control, summaries |
|
|
56
|
+
| `find` | `localFindFiles` | Time/size/permission filters, pagination |
|
|
57
|
+
| `cat`, `head` | `localGetFileContent` | matchString targeting, context lines, pagination |
|
|
58
|
+
|
|
59
|
+
**Local-First Research**:
|
|
60
|
+
1. **Start Local**: Use local tools to understand workspace context before GitHub research
|
|
61
|
+
2. **Understand Dependencies**: Check `package.json`, imports, local configs first
|
|
62
|
+
3. **Inspect node_modules**: Use `localSearchCode(path="node_modules/pkg", noIgnore=true)` to understand dependency internals
|
|
63
|
+
4. **Cross-Reference**: Compare local implementations with upstream GitHub repos
|
|
64
|
+
|
|
65
|
+
**node_modules Inspection**:
|
|
66
|
+
- Local tools respect `.gitignore` by default — use `noIgnore=true` to search inside `node_modules`
|
|
67
|
+
- Useful for: debugging dependency behavior, understanding library internals, finding undocumented APIs
|
|
68
|
+
- Example: `localSearchCode(pattern="createContext", path="node_modules/react", noIgnore=true)`
|
|
69
|
+
|
|
70
|
+
## When to Use Local vs GitHub
|
|
71
|
+
|
|
72
|
+
| Scenario | Use Local | Use GitHub |
|
|
73
|
+
|----------|-----------|------------|
|
|
74
|
+
| Current workspace code | ✅ | |
|
|
75
|
+
| Dependency source code | ✅ (node_modules) | ✅ (canonical) |
|
|
76
|
+
| External library research | | ✅ |
|
|
77
|
+
| PR history / blame | | ✅ |
|
|
78
|
+
| Package discovery | | ✅ (packageSearch) |
|
|
79
|
+
| Cross-repo patterns | | ✅ |
|
|
80
|
+
|
|
81
|
+
## The Research Cycle
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
PREPARE → DISCOVER → ANALYZE → OUTPUT
|
|
85
|
+
↑ ↓ ↓
|
|
86
|
+
└── dead end ←── need more
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 1. Prepare
|
|
90
|
+
Define exact goal. Identify entry point (repo, package, file). Set success criteria.
|
|
91
|
+
|
|
92
|
+
### 2. Discover
|
|
93
|
+
Use cheapest tool first. Start broad.
|
|
94
|
+
- **Local Structure?** `localViewStructure`
|
|
95
|
+
- **Local Pattern?** `localSearchCode`
|
|
96
|
+
- **Package?** `packageSearch`
|
|
97
|
+
- **Remote Repo?** `githubSearchRepositories`
|
|
98
|
+
|
|
99
|
+
### 3. Analyze
|
|
100
|
+
Read actual code. Trace execution flow.
|
|
101
|
+
- **Local Read:** `localGetFileContent`
|
|
102
|
+
- **Remote Read:** `githubGetFileContent`
|
|
103
|
+
- **History:** `githubSearchPullRequests`
|
|
104
|
+
|
|
105
|
+
### 4. Output
|
|
106
|
+
Answer with full file paths or GitHub links. Document gaps.
|
|
107
|
+
|
|
108
|
+
## Tool Transitions
|
|
109
|
+
|
|
110
|
+
**Local Transition Matrix**:
|
|
111
|
+
| From Tool | Need... | Go To Tool |
|
|
112
|
+
|-----------|---------|------------|
|
|
113
|
+
| `localViewStructure` | Find Pattern | `localSearchCode` |
|
|
114
|
+
| `localViewStructure` | File Content | `localGetFileContent` |
|
|
115
|
+
| `localSearchCode` | Context/Content | `localGetFileContent` |
|
|
116
|
+
| `localSearchCode` | More Patterns | `localSearchCode` (refine) |
|
|
117
|
+
| `localSearchCode` | Upstream Source | `packageSearch` → GitHub tools |
|
|
118
|
+
| `localFindFiles` | File Content | `localGetFileContent` |
|
|
119
|
+
| `localGetFileContent` | More Context | `localGetFileContent` (widen) |
|
|
120
|
+
| `localGetFileContent` | Trace Import | `localSearchCode` or GitHub |
|
|
121
|
+
|
|
122
|
+
**GitHub Transition Matrix**:
|
|
123
|
+
| From Tool | Need... | Go To Tool |
|
|
124
|
+
|-----------|---------|------------|
|
|
125
|
+
| `githubSearchCode` | Content | `githubGetFileContent` |
|
|
126
|
+
| `githubSearchRepositories` | Structure | `githubViewRepoStructure` |
|
|
127
|
+
| `packageSearch` | Repo Location | `githubViewRepoStructure` |
|
|
128
|
+
| `githubViewRepoStructure` | Find Pattern | `githubSearchCode` |
|
|
129
|
+
| `githubGetFileContent` | More Context | `githubGetFileContent` (widen) |
|
|
130
|
+
|
|
131
|
+
**Cross-Domain Transitions** (Local ↔ GitHub):
|
|
132
|
+
| From | Need... | Go To |
|
|
133
|
+
|------|---------|-------|
|
|
134
|
+
| Local code | Upstream implementation | `packageSearch` → GitHub tools |
|
|
135
|
+
| Local node_modules | Canonical source | `githubGetFileContent` (same path) |
|
|
136
|
+
| GitHub finding | Local usage | `localSearchCode` (same pattern) |
|
|
137
|
+
| GitHub PR | Local impact | `localSearchCode` (changed files) |
|
|
138
|
+
|
|
139
|
+
## Red Flags - STOP AND THINK
|
|
140
|
+
|
|
141
|
+
If you catch yourself thinking these, **STOP**:
|
|
142
|
+
|
|
143
|
+
- "I assume it works like..." → **Find evidence**
|
|
144
|
+
- "It's probably in `src/utils`..." → **Search first**
|
|
145
|
+
- "Based on the function name..." → **Read implementation**
|
|
146
|
+
- "I'll just guess the path..." → **Use structure tools first**
|
|
147
|
+
- "3 empty results..." → **Try semantic variants (auth → login)**
|
|
148
|
+
- "Too many results..." → **Add filters (path, extension, type)**
|
|
149
|
+
|
|
150
|
+
## Safety
|
|
151
|
+
|
|
152
|
+
- **Paths**: Within workspace (relative or absolute)
|
|
153
|
+
- **Sensitive paths**: `.git`, `.env*`, credentials filtered automatically
|
|
154
|
+
- **UTF-8**: `location.charOffset/charLength` are BYTE offsets (ripgrep)
|
|
155
|
+
- **Pagination**: Use `charLength` windows ~1000–4000; use `charOffset` to step
|
|
156
|
+
|
|
157
|
+
## Verification Checklist
|
|
158
|
+
|
|
159
|
+
Before outputting an answer:
|
|
160
|
+
|
|
161
|
+
- [ ] Every claim has a specific code citation
|
|
162
|
+
- [ ] File paths or GitHub URLs are complete
|
|
163
|
+
- [ ] Code is from the correct branch/version
|
|
164
|
+
- [ ] You have verified the code is not deprecated/dead
|
|
165
|
+
- [ ] You have checked for recent changes
|
|
166
|
+
|
|
167
|
+
## When Stuck
|
|
168
|
+
|
|
169
|
+
1. **Empty Results?** Try synonyms (e.g., `auth` → `credential`, `token`, `login`, `session`).
|
|
170
|
+
2. **Too Many?** Filter by extension (`type: "ts"`) or path (`path: "src/"`).
|
|
171
|
+
3. **Lost?** Go back to structure tools to understand the map.
|
|
172
|
+
4. **Loop (3+ no-progress)?** Refine or switch tools; after 5 → ask user.
|
|
173
|
+
|
|
174
|
+
## References
|
|
175
|
+
|
|
176
|
+
- **Tools**: `references/tool-reference.md` (Parameters & Tips)
|
|
177
|
+
- **Workflows**: `references/workflow-patterns.md` (Recipes)
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
# Tool Reference
|
|
2
|
+
|
|
3
|
+
Complete parameter reference for Octocode MCP tools.
|
|
4
|
+
|
|
5
|
+
**Required Fields (ALL queries)**: `mainResearchGoal`, `researchGoal`, `reasoning`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Local Tools
|
|
10
|
+
|
|
11
|
+
> **Priority**: ALWAYS prefer local tools over shell commands (`grep`, `ls`, `find`, `cat`)
|
|
12
|
+
|
|
13
|
+
### localViewStructure
|
|
14
|
+
|
|
15
|
+
Explore local directory structure with filtering and sorting.
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
{
|
|
19
|
+
path: string; // Directory path (required)
|
|
20
|
+
depth?: number; // 1-5 (default 1)
|
|
21
|
+
entriesPerPage?: number; // ≤20
|
|
22
|
+
entryPageNumber?: number; // Pagination
|
|
23
|
+
details?: boolean; // Show file sizes
|
|
24
|
+
hidden?: boolean; // Include dotfiles
|
|
25
|
+
extensions?: string[]; // Filter by extension
|
|
26
|
+
pattern?: string; // Filter by name pattern
|
|
27
|
+
filesOnly?: boolean;
|
|
28
|
+
directoriesOnly?: boolean;
|
|
29
|
+
sortBy?: "name" | "size" | "time" | "extension";
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Tips:**
|
|
34
|
+
- Start `depth: 1` at root, drill with `depth: 2` on specific dirs
|
|
35
|
+
- Use `details: true` to see file sizes
|
|
36
|
+
- Check `packages/` or `apps/` for monorepos
|
|
37
|
+
|
|
38
|
+
### localSearchCode
|
|
39
|
+
|
|
40
|
+
Fast pattern search with discovery mode and pagination.
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
{
|
|
44
|
+
pattern: string; // Search pattern (required)
|
|
45
|
+
path: string; // Search root (required)
|
|
46
|
+
filesOnly?: boolean; // Discovery mode - just list files
|
|
47
|
+
type?: string; // "ts", "py", "js" etc
|
|
48
|
+
include?: string[]; // Glob patterns to include
|
|
49
|
+
exclude?: string[]; // Glob patterns to exclude
|
|
50
|
+
excludeDir?: string[]; // Directories to skip
|
|
51
|
+
noIgnore?: boolean; // Search inside node_modules
|
|
52
|
+
matchesPerPage?: number; // 1-100
|
|
53
|
+
filesPerPage?: number; // ≤20
|
|
54
|
+
filePageNumber?: number; // Pagination
|
|
55
|
+
contextLines?: number; // Lines around match
|
|
56
|
+
caseSensitive?: boolean;
|
|
57
|
+
wholeWord?: boolean;
|
|
58
|
+
multiline?: boolean;
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Tips:**
|
|
63
|
+
- Start with `filesOnly: true` for discovery (fast, token-efficient)
|
|
64
|
+
- Use `noIgnore: true` to search inside `node_modules`
|
|
65
|
+
- Use `type` for common file extensions
|
|
66
|
+
- Returns `location.charOffset/charLength` as BYTE offsets (ripgrep)
|
|
67
|
+
|
|
68
|
+
**node_modules Example:**
|
|
69
|
+
```typescript
|
|
70
|
+
{ pattern: "createContext", path: "node_modules/react", noIgnore: true }
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### localGetFileContent
|
|
74
|
+
|
|
75
|
+
Read local file content with targeted extraction.
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
{
|
|
79
|
+
path: string; // File path (required)
|
|
80
|
+
// Choose ONE strategy:
|
|
81
|
+
matchString?: string; // Pattern to find
|
|
82
|
+
matchStringContextLines?: number; // 1-50 lines of context
|
|
83
|
+
matchStringIsRegex?: boolean;
|
|
84
|
+
matchStringCaseSensitive?: boolean;
|
|
85
|
+
charOffset?: number; // BYTE offset for pagination
|
|
86
|
+
charLength?: number; // BYTES to read (1000-4000 recommended)
|
|
87
|
+
startLine?: number; // Line range
|
|
88
|
+
endLine?: number;
|
|
89
|
+
fullContent?: boolean; // Small files only
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Tips:**
|
|
94
|
+
- Prefer `matchString` over `fullContent` for token efficiency
|
|
95
|
+
- `charOffset`/`charLength` are BYTES, not characters
|
|
96
|
+
- Use `charLength: 2000-4000` for pagination windows
|
|
97
|
+
- Large files require `charLength` or `matchString`
|
|
98
|
+
|
|
99
|
+
### localFindFiles
|
|
100
|
+
|
|
101
|
+
Find files by metadata (name, time, size, permissions).
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
{
|
|
105
|
+
path: string; // Search root (required)
|
|
106
|
+
name?: string; // "*.ts" pattern
|
|
107
|
+
iname?: string; // Case-insensitive name
|
|
108
|
+
names?: string[]; // Multiple patterns
|
|
109
|
+
type?: "f" | "d" | "l"; // file/directory/link
|
|
110
|
+
modifiedWithin?: string; // "7d", "2h", "30m"
|
|
111
|
+
modifiedBefore?: string;
|
|
112
|
+
sizeGreater?: string; // "10M", "1K"
|
|
113
|
+
sizeLess?: string;
|
|
114
|
+
excludeDir?: string[];
|
|
115
|
+
maxDepth?: number; // 1-10
|
|
116
|
+
filesPerPage?: number; // ≤20
|
|
117
|
+
filePageNumber?: number;
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Tips:**
|
|
122
|
+
- Results sorted by modified time (most recent first)
|
|
123
|
+
- Use `modifiedWithin: "7d"` to find recent changes
|
|
124
|
+
- Combine with `localGetFileContent` for content
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## GitHub Tools
|
|
129
|
+
|
|
130
|
+
### packageSearch
|
|
131
|
+
|
|
132
|
+
Find package repo location from npm/PyPI.
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
{
|
|
136
|
+
name: string; // Package name (required)
|
|
137
|
+
ecosystem: "npm" | "python"; // Registry (required)
|
|
138
|
+
searchLimit?: number; // 1-10 (npm only)
|
|
139
|
+
npmFetchMetadata?: boolean; // Get full npm metadata
|
|
140
|
+
pythonFetchMetadata?: boolean; // Get full PyPI metadata
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Tips:**
|
|
145
|
+
- Use `searchLimit: 1` if package name is known
|
|
146
|
+
- Python always returns 1 result (PyPI limitation)
|
|
147
|
+
- Follow with `githubViewRepoStructure` to explore the repo
|
|
148
|
+
|
|
149
|
+
### githubSearchRepositories
|
|
150
|
+
|
|
151
|
+
Discover repos by topics, keywords, stars.
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
{
|
|
155
|
+
keywordsToSearch?: string[]; // Search terms
|
|
156
|
+
topicsToSearch?: string[]; // GitHub topics
|
|
157
|
+
owner?: string; // Org/user filter
|
|
158
|
+
stars?: string; // ">1000", "100..500"
|
|
159
|
+
updated?: string; // ">2024-01-01"
|
|
160
|
+
sort?: "stars" | "forks" | "updated" | "best-match";
|
|
161
|
+
limit?: number; // 1-100
|
|
162
|
+
page?: number;
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Tips:**
|
|
167
|
+
- Use `stars: ">1000"` to filter noise in public repos
|
|
168
|
+
- Check `pushedAt` (last code change) > `updatedAt` (meta change)
|
|
169
|
+
- Archived repositories excluded automatically
|
|
170
|
+
|
|
171
|
+
### githubViewRepoStructure
|
|
172
|
+
|
|
173
|
+
Map repository directory layout.
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
{
|
|
177
|
+
owner: string; // Repo owner (required)
|
|
178
|
+
repo: string; // Repo name (required)
|
|
179
|
+
branch: string; // Branch (required)
|
|
180
|
+
path?: string; // Subpath (default "")
|
|
181
|
+
depth?: 1 | 2; // Recursion depth
|
|
182
|
+
entriesPerPage?: number; // ≤200
|
|
183
|
+
entryPageNumber?: number;
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Tips:**
|
|
188
|
+
- Start `depth: 1` at root, drill with `depth: 2` on subdirs
|
|
189
|
+
- `depth: 2` is slow on large dirs - use on specific subdirectories
|
|
190
|
+
- Check `packages/` or `apps/` individually for monorepos
|
|
191
|
+
- Auto-filters 85+ directories (.git, node_modules, dist, build, etc.)
|
|
192
|
+
|
|
193
|
+
### githubSearchCode
|
|
194
|
+
|
|
195
|
+
Find code patterns across GitHub.
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
{
|
|
199
|
+
keywordsToSearch: string[]; // Search terms (required)
|
|
200
|
+
match: "file" | "path"; // Content vs paths (required)
|
|
201
|
+
owner?: string; // Narrow to org
|
|
202
|
+
repo?: string; // Narrow to repo
|
|
203
|
+
path?: string; // Directory filter (strict prefix)
|
|
204
|
+
extension?: string; // File type
|
|
205
|
+
filename?: string;
|
|
206
|
+
limit?: number; // 1-100
|
|
207
|
+
page?: number;
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**WARNING:** NEVER cite search results directly. Search snippets are incomplete. ALWAYS follow up with `githubGetFileContent` to verify.
|
|
212
|
+
|
|
213
|
+
**Tips:**
|
|
214
|
+
- `match: "path"` for finding files by name
|
|
215
|
+
- `match: "file"` for searching content
|
|
216
|
+
- Prefer specifying `owner` & `repo` for precision and cost
|
|
217
|
+
- Start with 1-2 filters; 3+ filters risky (may return empty)
|
|
218
|
+
- Path matching is strict prefix: `path: "pkg"` finds `pkg/file`, NOT `parent/pkg/file`
|
|
219
|
+
|
|
220
|
+
### githubGetFileContent
|
|
221
|
+
|
|
222
|
+
Read file content with targeted extraction.
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
{
|
|
226
|
+
owner: string; // (required)
|
|
227
|
+
repo: string; // (required)
|
|
228
|
+
path: string; // (required)
|
|
229
|
+
branch?: string;
|
|
230
|
+
// Choose ONE strategy:
|
|
231
|
+
startLine?: number; // Line range
|
|
232
|
+
endLine?: number;
|
|
233
|
+
matchString?: string; // Pattern match
|
|
234
|
+
matchStringContextLines?: number; // 1-50
|
|
235
|
+
charOffset?: number; // Byte offset
|
|
236
|
+
charLength?: number; // Bytes to read
|
|
237
|
+
fullContent?: boolean; // Small files only
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**Tips:**
|
|
242
|
+
- Prefer `matchString` over `fullContent` for token efficiency
|
|
243
|
+
- Max file size: 300KB
|
|
244
|
+
- For pagination, use branch NAME (e.g., "main"), not commit SHA
|
|
245
|
+
|
|
246
|
+
### githubSearchPullRequests
|
|
247
|
+
|
|
248
|
+
Find PR history, metadata, diffs, and discussions.
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
{
|
|
252
|
+
owner?: string;
|
|
253
|
+
repo?: string;
|
|
254
|
+
prNumber?: number; // Ignores all other filters
|
|
255
|
+
query?: string; // Search text
|
|
256
|
+
state?: "open" | "closed";
|
|
257
|
+
merged?: boolean;
|
|
258
|
+
author?: string;
|
|
259
|
+
type?: "metadata" | "fullContent" | "partialContent";
|
|
260
|
+
partialContentMetadata?: Array<{
|
|
261
|
+
file: string;
|
|
262
|
+
additions?: number[];
|
|
263
|
+
deletions?: number[];
|
|
264
|
+
}>;
|
|
265
|
+
withComments?: boolean;
|
|
266
|
+
withCommits?: boolean;
|
|
267
|
+
limit?: number; // 1-10
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**Tips:**
|
|
272
|
+
- Start with `type: "metadata"` (token-efficient)
|
|
273
|
+
- `prNumber` ignores all other filters
|
|
274
|
+
- Use `type: "partialContent"` for specific file diffs
|
|
275
|
+
- Avoid `type: "fullContent"` on large PRs
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Error Recovery
|
|
280
|
+
|
|
281
|
+
| Situation | Action |
|
|
282
|
+
|-----------|--------|
|
|
283
|
+
| Empty results | Try semantic variants (auth → login, security, credentials) |
|
|
284
|
+
| Too many results | Add filters (path, extension, owner/repo, type) |
|
|
285
|
+
| File too large | Use `matchString` or `charLength` pagination |
|
|
286
|
+
| Path is directory | Use structure tool instead |
|
|
287
|
+
| Rate limit | Wait, try different tool |
|
|
288
|
+
| Local not found | Check path exists, try `hidden: true`, verify .gitignore |
|
|
289
|
+
|
|
290
|
+
## Query Batching
|
|
291
|
+
|
|
292
|
+
- GitHub tools: Max 3 queries per call
|
|
293
|
+
- Local tools: Max 5 queries per call
|
|
294
|
+
- Use parallel queries for independent searches
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
{
|
|
298
|
+
"queries": [
|
|
299
|
+
{ "pattern": "AuthService", "path": "src", "filesOnly": true },
|
|
300
|
+
{ "pattern": "authMiddleware", "path": "src", "filesOnly": true },
|
|
301
|
+
{ "pattern": "AuthUser", "path": "src", "filesOnly": true }
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
```
|