octocode-cli 1.1.1 → 1.2.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.
@@ -0,0 +1,403 @@
1
+ # Tool Reference - Implementation Agent
2
+
3
+ Complete parameter reference for implementation-focused tool usage.
4
+
5
+ **Required Fields (ALL queries)**: `mainResearchGoal`, `researchGoal`, `reasoning`
6
+
7
+ ---
8
+
9
+ ## Local Tools (PRIMARY - Always Prefer)
10
+
11
+ ### localViewStructure
12
+
13
+ Map codebase architecture before diving in.
14
+
15
+ ```typescript
16
+ {
17
+ path: string; // Directory path (required)
18
+ depth?: number; // 1-5 (default 1)
19
+ entriesPerPage?: number; // ≤20
20
+ entryPageNumber?: number; // Pagination
21
+ details?: boolean; // Show file sizes
22
+ hidden?: boolean; // Include dotfiles
23
+ extensions?: string[]; // Filter by extension
24
+ pattern?: string; // Filter by name pattern
25
+ filesOnly?: boolean;
26
+ directoriesOnly?: boolean;
27
+ sortBy?: "name" | "size" | "time" | "extension";
28
+ }
29
+ ```
30
+
31
+ **Implementation Tips:**
32
+ - Start `depth: 1` at root to understand project structure
33
+ - Use `depth: 2` on `src/` to see feature organization
34
+ - Check for monorepo patterns: `packages/`, `apps/`, `libs/`
35
+ - Note test directory structure for later
36
+
37
+ ---
38
+
39
+ ### localSearchCode
40
+
41
+ Find implementations, usages, and patterns.
42
+
43
+ ```typescript
44
+ {
45
+ pattern: string; // Search pattern (required)
46
+ path: string; // Search root (required)
47
+ filesOnly?: boolean; // Discovery mode - list files only
48
+ type?: string; // "ts", "py", "js" etc
49
+ include?: string[]; // Glob patterns to include
50
+ exclude?: string[]; // Glob patterns to exclude
51
+ excludeDir?: string[]; // Directories to skip
52
+ noIgnore?: boolean; // Search inside node_modules
53
+ matchesPerPage?: number; // 1-100
54
+ filesPerPage?: number; // ≤20
55
+ filePageNumber?: number; // Pagination
56
+ contextLines?: number; // Lines around match
57
+ caseSensitive?: boolean;
58
+ wholeWord?: boolean;
59
+ multiline?: boolean;
60
+ }
61
+ ```
62
+
63
+ **Implementation Tips:**
64
+ - `filesOnly: true` first for discovery (fast, token-efficient)
65
+ - Search for similar features: `export.*function.*CreateUser`
66
+ - Find tests: `describe.*"UserService"`
67
+ - Find types: `interface.*User|type.*User`
68
+ - Use `contextLines: 3` to see surrounding code
69
+
70
+ **Pattern Search Examples:**
71
+ ```typescript
72
+ // Find feature implementations
73
+ { pattern: "export class.*Service", path: "src", type: "ts", filesOnly: true }
74
+
75
+ // Find tests for a feature
76
+ { pattern: "describe.*UserService", path: "tests", type: "ts" }
77
+
78
+ // Find error handling patterns
79
+ { pattern: "catch.*Error|throw new", path: "src", type: "ts" }
80
+
81
+ // Find API endpoints
82
+ { pattern: "@(Get|Post|Put|Delete)\\(", path: "src", type: "ts" }
83
+
84
+ // Find React components
85
+ { pattern: "export.*function.*Component|export const.*:.*FC", path: "src", type: "tsx" }
86
+ ```
87
+
88
+ ---
89
+
90
+ ### localGetFileContent
91
+
92
+ Read implementation details with precision.
93
+
94
+ ```typescript
95
+ {
96
+ path: string; // File path (required)
97
+ // Choose ONE strategy:
98
+ matchString?: string; // Pattern to find
99
+ matchStringContextLines?: number; // 1-50 lines of context
100
+ matchStringIsRegex?: boolean;
101
+ matchStringCaseSensitive?: boolean;
102
+ charOffset?: number; // BYTE offset for pagination
103
+ charLength?: number; // BYTES to read (2000-4000 recommended)
104
+ startLine?: number; // Line range
105
+ endLine?: number;
106
+ fullContent?: boolean; // Small files only (<100 lines)
107
+ }
108
+ ```
109
+
110
+ **Implementation Tips:**
111
+ - Use `matchString` + `matchStringContextLines: 20` for functions
112
+ - Use `startLine`/`endLine` when you know the location
113
+ - `fullContent: true` only for small config files
114
+ - For large files, use multiple `matchString` calls
115
+
116
+ **Reading Examples:**
117
+ ```typescript
118
+ // Read a specific function
119
+ { path: "src/service.ts", matchString: "async function processData", matchStringContextLines: 30 }
120
+
121
+ // Read a class definition
122
+ { path: "src/models/User.ts", matchString: "export class User", matchStringContextLines: 50 }
123
+
124
+ // Read test structure
125
+ { path: "tests/service.test.ts", matchString: "describe.*Service", matchStringContextLines: 40 }
126
+
127
+ // Read config file entirely
128
+ { path: "tsconfig.json", fullContent: true }
129
+ ```
130
+
131
+ ---
132
+
133
+ ### localFindFiles
134
+
135
+ Find files by metadata for targeted investigation.
136
+
137
+ ```typescript
138
+ {
139
+ path: string; // Search root (required)
140
+ name?: string; // "*.ts" pattern
141
+ iname?: string; // Case-insensitive name
142
+ names?: string[]; // Multiple patterns
143
+ type?: "f" | "d" | "l"; // file/directory/link
144
+ modifiedWithin?: string; // "7d", "2h", "30m"
145
+ modifiedBefore?: string;
146
+ sizeGreater?: string; // "10M", "1K"
147
+ sizeLess?: string;
148
+ excludeDir?: string[];
149
+ maxDepth?: number; // 1-10
150
+ filesPerPage?: number; // ≤20
151
+ filePageNumber?: number;
152
+ }
153
+ ```
154
+
155
+ **Implementation Tips:**
156
+ - Find recently changed files: `modifiedWithin: "1d"`
157
+ - Find config files: `names: ["*.config.*", "*.json"]`
158
+ - Find large files that might need breaking up: `sizeGreater: "200K"`
159
+
160
+ ---
161
+
162
+ ## LSP Tools (Semantic Code Intelligence)
163
+
164
+ ### lspGotoDefinition
165
+
166
+ Navigate to symbol definitions - essential for tracing imports.
167
+
168
+ ```typescript
169
+ {
170
+ uri: string; // File path (required)
171
+ symbolName: string; // EXACT symbol name (required)
172
+ lineHint: number; // 1-indexed line number (required)
173
+ orderHint?: number; // 0-indexed if multiple on same line
174
+ contextLines?: number; // Lines around definition (0-20)
175
+ }
176
+ ```
177
+
178
+ **Implementation Tips:**
179
+ - Use when you see `import { X } from './module'` → trace X's definition
180
+ - `lineHint` must be within ±2 lines of actual location
181
+ - `symbolName` must be EXACT text, not partial
182
+
183
+ **Example:**
184
+ ```typescript
185
+ // Trace an import
186
+ { uri: "src/service.ts", symbolName: "UserRepository", lineHint: 3, contextLines: 10 }
187
+
188
+ // Find type definition
189
+ { uri: "src/handlers/user.ts", symbolName: "UserDTO", lineHint: 5 }
190
+ ```
191
+
192
+ ---
193
+
194
+ ### lspFindReferences
195
+
196
+ Find all usages of a symbol - critical for impact analysis.
197
+
198
+ ```typescript
199
+ {
200
+ uri: string; // File path (required)
201
+ symbolName: string; // EXACT symbol name (required)
202
+ lineHint: number; // 1-indexed line (required)
203
+ includeDeclaration?: boolean; // Include definition (default true)
204
+ orderHint?: number;
205
+ contextLines?: number; // 0-10
206
+ referencesPerPage?: number; // 1-50
207
+ page?: number;
208
+ }
209
+ ```
210
+
211
+ **Implementation Tips:**
212
+ - **ALWAYS run before modifying public APIs**
213
+ - Use `includeDeclaration: false` to see only usages
214
+ - Check all pages if many references
215
+
216
+ **Example:**
217
+ ```typescript
218
+ // Find all usages of a function before changing it
219
+ { uri: "src/utils.ts", symbolName: "formatDate", lineHint: 15, includeDeclaration: false }
220
+
221
+ // Find all callers of an API
222
+ { uri: "src/api/users.ts", symbolName: "getUser", lineHint: 42, contextLines: 3 }
223
+ ```
224
+
225
+ ---
226
+
227
+ ### lspCallHierarchy
228
+
229
+ Trace function call relationships - understand data flow.
230
+
231
+ ```typescript
232
+ {
233
+ uri: string; // File path (required)
234
+ symbolName: string; // Function name (required)
235
+ lineHint: number; // 1-indexed (required)
236
+ direction: "incoming" | "outgoing"; // (required)
237
+ depth?: number; // 1-3 (default 1)
238
+ orderHint?: number;
239
+ contextLines?: number; // 0-10
240
+ callsPerPage?: number; // 1-30
241
+ page?: number;
242
+ }
243
+ ```
244
+
245
+ **Implementation Tips:**
246
+ - `direction: "incoming"` → "Who calls this function?"
247
+ - `direction: "outgoing"` → "What does this function call?"
248
+ - Use `depth: 2` to see transitive calls
249
+ - Limit depth to avoid timeout on hot paths
250
+
251
+ **Example:**
252
+ ```typescript
253
+ // Who calls this function?
254
+ { uri: "src/auth/validate.ts", symbolName: "validateToken", lineHint: 20, direction: "incoming" }
255
+
256
+ // What does this function depend on?
257
+ { uri: "src/handlers/order.ts", symbolName: "processOrder", lineHint: 50, direction: "outgoing", depth: 2 }
258
+ ```
259
+
260
+ ---
261
+
262
+ ## GitHub Tools (When Patterns Not Found Locally)
263
+
264
+ ### packageSearch
265
+
266
+ Find package repo locations for upstream research.
267
+
268
+ ```typescript
269
+ {
270
+ name: string; // Package name (required)
271
+ ecosystem: "npm" | "python"; // Registry (required)
272
+ searchLimit?: number; // 1-10
273
+ npmFetchMetadata?: boolean;
274
+ pythonFetchMetadata?: boolean;
275
+ }
276
+ ```
277
+
278
+ **Use When:**
279
+ - Need to understand how a dependency works internally
280
+ - Looking for canonical implementation patterns
281
+ - Debugging library behavior
282
+
283
+ ---
284
+
285
+ ### githubSearchCode
286
+
287
+ Find patterns in external repositories.
288
+
289
+ ```typescript
290
+ {
291
+ keywordsToSearch: string[]; // Search terms (required)
292
+ match: "file" | "path"; // Content vs paths (required)
293
+ owner?: string; // Org filter
294
+ repo?: string; // Repo filter
295
+ path?: string; // Directory filter
296
+ extension?: string; // File type
297
+ filename?: string;
298
+ limit?: number; // 1-100
299
+ }
300
+ ```
301
+
302
+ **Use When:**
303
+ - Can't find pattern in local codebase
304
+ - Need reference implementation from upstream
305
+ - Researching library usage patterns
306
+
307
+ ---
308
+
309
+ ### githubGetFileContent
310
+
311
+ Read file content from GitHub repositories.
312
+
313
+ ```typescript
314
+ {
315
+ owner: string; // (required)
316
+ repo: string; // (required)
317
+ path: string; // (required)
318
+ branch?: string;
319
+ matchString?: string;
320
+ matchStringContextLines?: number;
321
+ fullContent?: boolean; // Small files only
322
+ }
323
+ ```
324
+
325
+ **Use When:**
326
+ - Need to read upstream source code
327
+ - Comparing local node_modules with canonical
328
+ - Finding reference implementations
329
+
330
+ ---
331
+
332
+ ## Implementation-Specific Patterns
333
+
334
+ ### Before Modifying Any Code
335
+
336
+ ```typescript
337
+ // 1. Find all references
338
+ { uri: "src/target.ts", symbolName: "functionToModify", lineHint: N, includeDeclaration: false }
339
+
340
+ // 2. Understand incoming calls
341
+ { uri: "src/target.ts", symbolName: "functionToModify", lineHint: N, direction: "incoming" }
342
+
343
+ // 3. Understand outgoing dependencies
344
+ { uri: "src/target.ts", symbolName: "functionToModify", lineHint: N, direction: "outgoing" }
345
+ ```
346
+
347
+ ### Finding Similar Implementations
348
+
349
+ ```typescript
350
+ // 1. Search for similar features
351
+ { pattern: "export.*function.*Similar", path: "src", filesOnly: true }
352
+
353
+ // 2. Read the implementation
354
+ { path: "src/found/file.ts", matchString: "export function similar", matchStringContextLines: 40 }
355
+
356
+ // 3. Find its tests
357
+ { pattern: "describe.*Similar|test.*similar", path: "tests", filesOnly: true }
358
+ ```
359
+
360
+ ### Understanding Test Patterns
361
+
362
+ ```typescript
363
+ // 1. Find test file
364
+ { pattern: "describe.*TargetFeature", path: "tests", type: "ts", filesOnly: true }
365
+
366
+ // 2. Read test structure
367
+ { path: "tests/target.test.ts", matchString: "describe", matchStringContextLines: 50 }
368
+
369
+ // 3. Find mock patterns
370
+ { pattern: "mock|jest\\.fn|vi\\.fn|spy", path: "tests/target.test.ts" }
371
+ ```
372
+
373
+ ---
374
+
375
+ ## Query Batching
376
+
377
+ - Local tools: Max 5 queries per call
378
+ - GitHub tools: Max 3 queries per call
379
+ - LSP tools: Max 5 queries per call
380
+
381
+ **Parallel Research Example:**
382
+ ```typescript
383
+ {
384
+ "queries": [
385
+ { "pattern": "AuthService", "path": "src", "filesOnly": true },
386
+ { "pattern": "UserService", "path": "src", "filesOnly": true },
387
+ { "pattern": "describe.*Auth|describe.*User", "path": "tests", "filesOnly": true }
388
+ ]
389
+ }
390
+ ```
391
+
392
+ ---
393
+
394
+ ## Error Recovery
395
+
396
+ | Situation | Action |
397
+ |-----------|--------|
398
+ | Empty results | Try semantic variants, broaden path |
399
+ | Too many results | Add filters (type, path, extension) |
400
+ | File too large | Use `matchString` or `charLength` |
401
+ | Symbol not found (LSP) | Verify exact name, check lineHint |
402
+ | Definition in node_modules | Use `packageSearch` → GitHub tools |
403
+