@octocodeai/octocode-core 16.1.0 → 16.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.
- package/dist/configLoader.d.ts +0 -4
- package/dist/data/compressed.js +1 -1
- package/dist/data/default.json +288 -249
- package/dist/resources/global.js +1 -1
- package/dist/resources/tools/_toolkit.d.ts +55 -0
- package/dist/resources/tools/_toolkit.js +1 -0
- package/dist/resources/tools/ghCloneRepo.d.ts +27 -0
- package/dist/resources/tools/ghCloneRepo.js +1 -0
- package/dist/resources/tools/ghGetFileContent.d.ts +32 -0
- package/dist/resources/tools/ghGetFileContent.js +1 -0
- package/dist/resources/tools/ghHistoryResearch.d.ts +133 -0
- package/dist/resources/tools/ghHistoryResearch.js +1 -0
- package/dist/resources/tools/ghSearchCode.d.ts +23 -0
- package/dist/resources/tools/ghSearchCode.js +1 -0
- package/dist/resources/tools/ghSearchRepos.d.ts +40 -0
- package/dist/resources/tools/ghSearchRepos.js +1 -0
- package/dist/resources/tools/ghViewRepoStructure.d.ts +17 -0
- package/dist/resources/tools/ghViewRepoStructure.js +1 -0
- package/dist/resources/tools/localBinaryInspect.d.ts +39 -0
- package/dist/resources/tools/localBinaryInspect.js +1 -0
- package/dist/resources/tools/localFindFiles.d.ts +39 -0
- package/dist/resources/tools/localFindFiles.js +1 -1
- package/dist/resources/tools/localGetFileContent.d.ts +22 -0
- package/dist/resources/tools/localGetFileContent.js +1 -1
- package/dist/resources/tools/localSearchCode.d.ts +49 -0
- package/dist/resources/tools/localSearchCode.js +1 -1
- package/dist/resources/tools/localViewStructure.d.ts +27 -0
- package/dist/resources/tools/localViewStructure.js +1 -1
- package/dist/resources/tools/lspGetSemantics.d.ts +79 -0
- package/dist/resources/tools/lspGetSemantics.js +1 -0
- package/dist/resources/tools/npmSearch.d.ts +11 -0
- package/dist/resources/tools/npmSearch.js +1 -0
- package/dist/schemas/extraTypes.d.ts +0 -36
- package/dist/schemas/index.d.ts +13 -455
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/outputs.d.ts +1 -13
- package/dist/schemas/outputs.js +1 -1
- package/dist/schemas/runtime.d.ts +0 -21
- package/dist/schemas/runtime.js +1 -1
- package/dist/types/index.d.ts +10 -57
- package/package.json +1 -1
- package/dist/resources/tools/githubCloneRepo.d.ts +0 -2
- package/dist/resources/tools/githubCloneRepo.js +0 -1
- package/dist/resources/tools/githubGetFileContent.d.ts +0 -2
- package/dist/resources/tools/githubGetFileContent.js +0 -1
- package/dist/resources/tools/githubSearchCode.d.ts +0 -2
- package/dist/resources/tools/githubSearchCode.js +0 -1
- package/dist/resources/tools/githubSearchPullRequests.d.ts +0 -2
- package/dist/resources/tools/githubSearchPullRequests.js +0 -1
- package/dist/resources/tools/githubSearchRepositories.d.ts +0 -2
- package/dist/resources/tools/githubSearchRepositories.js +0 -1
- package/dist/resources/tools/githubViewRepoStructure.d.ts +0 -2
- package/dist/resources/tools/githubViewRepoStructure.js +0 -1
- package/dist/resources/tools/lspGetSemanticContent.d.ts +0 -2
- package/dist/resources/tools/lspGetSemanticContent.js +0 -1
- package/dist/resources/tools/packageSearch.d.ts +0 -2
- package/dist/resources/tools/packageSearch.js +0 -1
|
@@ -1,2 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
import type { ToolSpec } from "../../types/index.js";
|
|
2
3
|
export declare const localSearchCode: ToolSpec;
|
|
4
|
+
export declare const RipgrepQuerySchema: z.ZodObject<{
|
|
5
|
+
keywords: z.ZodOptional<z.ZodString>;
|
|
6
|
+
path: z.ZodString;
|
|
7
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
8
|
+
paginated: "paginated";
|
|
9
|
+
discovery: "discovery";
|
|
10
|
+
detailed: "detailed";
|
|
11
|
+
structural: "structural";
|
|
12
|
+
}>>;
|
|
13
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
14
|
+
rule: z.ZodOptional<z.ZodString>;
|
|
15
|
+
fixedString: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
perlRegex: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
caseInsensitive: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
caseSensitive: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
wholeWord: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
invertMatch: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
22
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
+
excludeDir: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
24
|
+
noIgnore: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
filesOnly: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
filesWithoutMatch: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
contextLines: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
matchContentLength: z.ZodDefault<z.ZodNumber>;
|
|
30
|
+
maxMatchesPerFile: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
maxFiles: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
multiline: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
+
multilineDotall: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
sort: z.ZodDefault<z.ZodEnum<{
|
|
35
|
+
path: "path";
|
|
36
|
+
modified: "modified";
|
|
37
|
+
created: "created";
|
|
38
|
+
accessed: "accessed";
|
|
39
|
+
}>>;
|
|
40
|
+
sortReverse: z.ZodOptional<z.ZodBoolean>;
|
|
41
|
+
langType: z.ZodOptional<z.ZodString>;
|
|
42
|
+
countLinesPerFile: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
countMatchesPerFile: z.ZodOptional<z.ZodBoolean>;
|
|
44
|
+
matchPage: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
itemsPerPage: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
47
|
+
id: z.ZodOptional<z.ZodString>;
|
|
48
|
+
mainResearchGoal: z.ZodOptional<z.ZodString>;
|
|
49
|
+
researchGoal: z.ZodOptional<z.ZodString>;
|
|
50
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const localSearchCode={name:"localSearchCode",description:
|
|
1
|
+
import{z as e}from"zod";import{buildObject as t,contextLines as a,DEFAULT_MATCH_CONTENT_LENGTH as s,intRange as i,MAX_MATCH_CONTENT_LENGTH as n,MAX_PAGE_NUMBER as o,metaFields as l,optionalPageNumber as r,pageNumber as c,StringArray as u}from"./_toolkit.js";export const localSearchCode={name:"localSearchCode",description:'Local code/text search for file+line.\nChoose mode first: "paginated" returns snippets; "discovery" returns file paths only — cheapest orientation; "detailed" returns expanded context per match.\nFor count-only output use countLinesPerFile:true or countMatchesPerFile:true — do NOT use mode:"count" (does not exist).\nOutput signal: searchEngine flags when a reduced-capability fallback ran — perlRegex features are dropped and countMatchesPerFile becomes line-count semantics.\nPage only on hasMore; use matchPage for more matches in one file; narrow include/exclude/path before paging noisy results.\nBatch: pass up to 5 {keywords, path} objects in one call — e.g. search same keyword across multiple directories simultaneously.\nevidence.answerReady:true means at least one result exists; check pagination.hasMore separately before deciding to stop.\nPair with lspGetSemantics for semantic navigation — matches[0].line feeds directly as lineHint for definition, references, and call hierarchy.\nmode:"structural" (+ pattern OR rule): AST/shape queries regex can\'t express and that aren\'t symbol-identity questions — e.g. eval($X) call sites excluding comments/strings, or async fns lacking try/catch. pattern is a code-shaped query (foo($X), console.log($$$ARGS)); rule is a YAML relational/composite blob (not/inside/has/all/any). Returns node ranges; matches[].line still feeds lspGetSemantics lineHint. keywords is ignored in this mode.\nNext: localGetFileContent(path, matchString=keyword) to read context; lspGetSemantics(uri=files[0].path, symbolName, lineHint=matches[0].line) for semantics; localViewStructure if root unknown; localFindFiles when searching by filename or metadata.',schema:{keywords:"The search pattern (text or regex). Set fixedString:true for a literal match, or perlRegex:true for advanced regex features (lookaheads, backreferences).",path:"File or directory to search (absolute paths are safest).",mode:'"paginated": matches with snippets. "discovery": file paths only — cheapest, for orienting before you read. "detailed": snippets with surrounding context, for deep reading without a follow-up read. "structural": AST/shape search (set pattern OR rule) for queries regex can\'t express. For counts only, set countLinesPerFile or countMatchesPerFile.',pattern:'mode:"structural" only. An ast-grep code-shaped pattern. Metavariables: $X matches a single node (captured), $$$ARGS matches a list of nodes. E.g. eval($X) / console.log($$$) / oldApi.foo($X). Matches code structure, so comments and strings never false-positive. Mutually exclusive with rule.',rule:'mode:"structural" only. A YAML relational/composite ast-grep rule blob for what plain patterns can\'t express — negation and parent/child relations (not/inside/has/all/any). E.g. "rule:\\n pattern: await $C\\n inside:\\n kind: for_statement\\n stopBy: end". NOTE: relational sub-rules need stopBy: end to walk all ancestors/descendants, else they silently match nothing. Mutually exclusive with pattern.',fixedString:"Literal match (disables regex). Mutually exclusive with perlRegex.",perlRegex:"Advanced regex (lookaheads, backreferences). Mutually exclusive with fixedString.",caseInsensitive:"Case-insensitive matching. Mutually exclusive with caseSensitive.",caseSensitive:"Case-sensitive matching. Mutually exclusive with caseInsensitive.",wholeWord:"Matches whole words only.",invertMatch:"Returns non-matching lines. To list files lacking the pattern, use filesWithoutMatch instead.",include:"Globs of files to search, e.g. '*.ts', 'src/**/*.tsx'. Only files matching any glob are searched.",exclude:"Globs of files to skip, e.g. '*.min.js', 'dist/**'.",excludeDir:"Directory names to skip entirely (e.g. 'node_modules', 'dist', '.git') — faster than exclude globs for whole directories.",noIgnore:"Searches files normally hidden by .gitignore/.ignore.",hidden:"Includes hidden (dot) files.",filesOnly:"Returns matching file paths without line content. Mutually exclusive with filesWithoutMatch.",filesWithoutMatch:"Returns files that do NOT contain the pattern — useful to find files missing a required import or header. Mutually exclusive with filesOnly.",contextLines:"Lines of context around each match. Pair with mode:'detailed' for self-contained snippets.",matchContentLength:"Characters kept per match snippet. Raise for minified code or JSON, or when truncation hides matches.",maxMatchesPerFile:"Caps matches per file and sets the per-file page size; when a file has more, file.pagination.hasMore appears — page it with matchPage. No effect in filesOnly/count modes.",maxFiles:"Caps how many matched files are returned.",multiline:"Lets a match span lines. Add multilineDotall to let . cross newlines.",multilineDotall:"Lets . match newlines too. Requires multiline:true.",sort:"Order results by path, modified time, access time, or creation time.",sortReverse:"Reverses the sort (e.g. sort:'modified' + sortReverse:true = oldest first).",langType:"Language filter (ts, js, py, go, rust, …) — more precise than include globs.",countLinesPerFile:"Returns the count of matching lines per file instead of content — good for orientation (which files have the most hits). Mutually exclusive with countMatchesPerFile.",countMatchesPerFile:"Returns the total match count per file (counts multiple hits on one line). Mutually exclusive with countLinesPerFile.",matchPage:"Page within one file's matches; pair with maxMatchesPerFile to walk a noisy file.",itemsPerPage:"Files per page.",page:"Result page."}};export const RipgrepQuerySchema=t(localSearchCode.schema,{...l,keywords:e.string().optional(),path:e.string(),mode:e.enum(["paginated","discovery","detailed","structural"]).default("paginated"),pattern:e.string().optional(),rule:e.string().optional(),fixedString:e.boolean().optional(),perlRegex:e.boolean().optional(),caseInsensitive:e.boolean().optional(),caseSensitive:e.boolean().optional(),wholeWord:e.boolean().optional(),invertMatch:e.boolean().optional(),include:u,exclude:u,excludeDir:u,noIgnore:e.boolean().optional(),hidden:e.boolean().optional(),filesOnly:e.boolean().optional(),filesWithoutMatch:e.boolean().optional(),contextLines:a(),matchContentLength:i(1,n).default(s),maxMatchesPerFile:i(1,n).optional(),maxFiles:i(1,n).optional(),multiline:e.boolean().optional(),multilineDotall:e.boolean().optional(),sort:e.enum(["path","modified","accessed","created"]).default("path"),sortReverse:e.boolean().optional(),langType:e.string().optional(),countLinesPerFile:e.boolean().optional(),countMatchesPerFile:e.boolean().optional(),matchPage:r(),itemsPerPage:i(1,o).optional(),page:c()}).superRefine((e,t)=>{if("structural"===e.mode){e.pattern||e.rule||t.addIssue({code:"custom",message:'mode:"structural" requires `pattern` (a code-shaped query) or `rule` (a YAML relational rule).',path:["pattern"]}),e.pattern&&e.rule&&t.addIssue({code:"custom",message:"`pattern` and `rule` are mutually exclusive.",path:["rule"]});for(const a of["fixedString","perlRegex","wholeWord","invertMatch","multiline","multilineDotall"])e[a]&&t.addIssue({code:"custom",message:`\`${a}\` is not valid with mode:"structural".`,path:[a]})}else(e.pattern||e.rule)&&t.addIssue({code:"custom",message:'`pattern`/`rule` require mode:"structural".',path:[e.pattern?"pattern":"rule"]}),e.keywords||t.addIssue({code:"custom",message:'`keywords` is required unless mode:"structural".',path:["keywords"]});e.filesOnly&&e.filesWithoutMatch&&t.addIssue({code:"custom",message:"filesOnly and filesWithoutMatch are mutually exclusive.",path:["filesWithoutMatch"]}),e.fixedString&&e.perlRegex&&t.addIssue({code:"custom",message:"fixedString and perlRegex are mutually exclusive.",path:["perlRegex"]}),e.caseSensitive&&e.caseInsensitive&&t.addIssue({code:"custom",message:"caseSensitive and caseInsensitive are mutually exclusive.",path:["caseInsensitive"]}),e.multilineDotall&&!e.multiline&&t.addIssue({code:"custom",message:"multilineDotall requires multiline=true.",path:["multilineDotall"]}),e.countLinesPerFile&&e.countMatchesPerFile&&t.addIssue({code:"custom",message:"countLinesPerFile and countMatchesPerFile are mutually exclusive.",path:["countMatchesPerFile"]})});
|
|
@@ -1,2 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
import type { ToolSpec } from "../../types/index.js";
|
|
2
3
|
export declare const localViewStructure: ToolSpec;
|
|
4
|
+
export declare const ViewStructureQuerySchema: z.ZodObject<{
|
|
5
|
+
path: z.ZodString;
|
|
6
|
+
details: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
sortBy: z.ZodDefault<z.ZodEnum<{
|
|
9
|
+
extension: "extension";
|
|
10
|
+
size: "size";
|
|
11
|
+
name: "name";
|
|
12
|
+
time: "time";
|
|
13
|
+
}>>;
|
|
14
|
+
reverse: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
16
|
+
directoriesOnly: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
filesOnly: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
recursive: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
20
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
showFileLastModified: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
24
|
+
itemsPerPage: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
id: z.ZodOptional<z.ZodString>;
|
|
26
|
+
mainResearchGoal: z.ZodOptional<z.ZodString>;
|
|
27
|
+
researchGoal: z.ZodOptional<z.ZodString>;
|
|
28
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const localViewStructure={name:"localViewStructure",description:
|
|
1
|
+
import{z as e}from"zod";import{buildObject as t,intRange as i,MAX_LOCAL_DEPTH as o,MAX_LOCAL_ITEMS_PER_PAGE as s,MAX_LOCAL_LIMIT as n,metaFields as a,pageNumber as r,StringArray as l}from"./_toolkit.js";export const localViewStructure={name:"localViewStructure",description:'Browse a local directory tree. Returns files[], folders[], and links[] (symlinks) at each level. When details:true or showFileLastModified:true, switches to entries[] objects with size, permissions, and timestamps.\nUse this to map a directory before searching. Use localFindFiles when you need metadata (size, modified date) or filename patterns. Use localSearchCode(mode:"discovery") to find which files contain a pattern.\nMutual exclusion: filesOnly and directoriesOnly cannot both be true.\nBulk: queries:[{path:d1},{path:d2}] to browse multiple directories in one call (max 5).\nPaginate with page=N when pagination.hasMore is true.\nNext: localGetFileContent(path), localSearchCode, lspGetSemantics after localSearchCode gives uri/symbolName/lineHint.',schema:{path:"Directory to browse (absolute or workspace-relative). Defaults to the workspace root.",details:"Returns per-entry objects with size, permissions, and dates (structured entries[] output).",hidden:"Includes hidden (dot) files and directories, e.g. .env, .git, .github.",sortBy:"Ordering. 'name': A–Z. 'size': by bytes. 'time': by last-modified (implicitly enables showFileLastModified). 'extension': grouped by file type.",reverse:"Reverses the sort (e.g. sortBy:'time' + reverse:true = oldest first).",pattern:"Name filter — a glob (e.g. '*.ts') or plain substring; only matching entries are returned. For regex, use localFindFiles.",directoriesOnly:"Returns directories only. Mutually exclusive with filesOnly.",filesOnly:"Returns files only. Mutually exclusive with directoriesOnly.",recursive:"Descends into subdirectories (top level only when off). When on without maxDepth, depth is capped automatically; set maxDepth to control cost.",extensions:"Extension whitelist, without dots, e.g. ['ts', 'tsx', 'js']. Only matching files are returned; directories always appear.",maxDepth:"Recursion depth when recursive is on (0 = immediate children). Start shallow on large monorepos, then drill in.",limit:"Caps how many entries are discovered before pagination — guards against huge scans. Distinct from page size.",showFileLastModified:"Adds last-modified timestamps per file. Independent of details. Use to spot recently changed files without switching to localFindFiles.",page:"Result page.",itemsPerPage:"Entries per page."}};export const ViewStructureQuerySchema=t(localViewStructure.schema,{...a,path:e.string(),details:e.boolean().optional(),hidden:e.boolean().optional(),sortBy:e.enum(["name","size","time","extension"]).default("name"),reverse:e.boolean().optional(),pattern:e.string().optional(),directoriesOnly:e.boolean().optional(),filesOnly:e.boolean().optional(),recursive:e.boolean().optional(),extensions:l,maxDepth:i(0,o).optional(),limit:i(1,n).optional(),showFileLastModified:e.boolean().optional(),page:r(),itemsPerPage:i(1,s).optional()}).superRefine((e,t)=>{e.filesOnly&&e.directoriesOnly&&t.addIssue({code:"custom",message:"filesOnly and directoriesOnly are mutually exclusive.",path:["directoriesOnly"]})});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ToolSpec } from "../../types/index.js";
|
|
3
|
+
export declare const lspGetSemantics: ToolSpec;
|
|
4
|
+
export declare const LSPGotoDefinitionQuerySchema: z.ZodObject<{
|
|
5
|
+
contextLines: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
uri: z.ZodString;
|
|
7
|
+
symbolName: z.ZodString;
|
|
8
|
+
lineHint: z.ZodNumber;
|
|
9
|
+
orderHint: z.ZodDefault<z.ZodNumber>;
|
|
10
|
+
id: z.ZodOptional<z.ZodString>;
|
|
11
|
+
mainResearchGoal: z.ZodOptional<z.ZodString>;
|
|
12
|
+
researchGoal: z.ZodOptional<z.ZodString>;
|
|
13
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare const LSPFindReferencesQuerySchema: z.ZodObject<{
|
|
16
|
+
includeDeclaration: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
contextLines: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
itemsPerPage: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
20
|
+
groupByFile: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
uri: z.ZodString;
|
|
22
|
+
symbolName: z.ZodString;
|
|
23
|
+
lineHint: z.ZodNumber;
|
|
24
|
+
orderHint: z.ZodDefault<z.ZodNumber>;
|
|
25
|
+
id: z.ZodOptional<z.ZodString>;
|
|
26
|
+
mainResearchGoal: z.ZodOptional<z.ZodString>;
|
|
27
|
+
researchGoal: z.ZodOptional<z.ZodString>;
|
|
28
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export declare const LSPCallHierarchyQuerySchema: z.ZodObject<{
|
|
31
|
+
direction: z.ZodEnum<{
|
|
32
|
+
incoming: "incoming";
|
|
33
|
+
outgoing: "outgoing";
|
|
34
|
+
}>;
|
|
35
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
contextLines: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
itemsPerPage: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
39
|
+
uri: z.ZodString;
|
|
40
|
+
symbolName: z.ZodString;
|
|
41
|
+
lineHint: z.ZodNumber;
|
|
42
|
+
orderHint: z.ZodDefault<z.ZodNumber>;
|
|
43
|
+
id: z.ZodOptional<z.ZodString>;
|
|
44
|
+
mainResearchGoal: z.ZodOptional<z.ZodString>;
|
|
45
|
+
researchGoal: z.ZodOptional<z.ZodString>;
|
|
46
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export declare const LspGetSemanticsQuerySchema: z.ZodObject<{
|
|
49
|
+
uri: z.ZodString;
|
|
50
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
51
|
+
references: "references";
|
|
52
|
+
definition: "definition";
|
|
53
|
+
callers: "callers";
|
|
54
|
+
callees: "callees";
|
|
55
|
+
callHierarchy: "callHierarchy";
|
|
56
|
+
hover: "hover";
|
|
57
|
+
documentSymbols: "documentSymbols";
|
|
58
|
+
typeDefinition: "typeDefinition";
|
|
59
|
+
implementation: "implementation";
|
|
60
|
+
}>>;
|
|
61
|
+
symbolName: z.ZodOptional<z.ZodString>;
|
|
62
|
+
lineHint: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
orderHint: z.ZodDefault<z.ZodNumber>;
|
|
64
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
includeDeclaration: z.ZodDefault<z.ZodBoolean>;
|
|
66
|
+
groupByFile: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
68
|
+
itemsPerPage: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
contextLines: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
71
|
+
structured: "structured";
|
|
72
|
+
compact: "compact";
|
|
73
|
+
}>>;
|
|
74
|
+
workspaceRoot: z.ZodOptional<z.ZodString>;
|
|
75
|
+
id: z.ZodOptional<z.ZodString>;
|
|
76
|
+
mainResearchGoal: z.ZodOptional<z.ZodString>;
|
|
77
|
+
researchGoal: z.ZodOptional<z.ZodString>;
|
|
78
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as e}from"zod";import{buildObject as t,contextLines as n,intRange as o,MAX_LINE_NUMBER as i,MAX_LOCAL_DEPTH as l,MAX_ORDER_HINT as a,MAX_PR_ITEMS_PER_PAGE as s,metaFields as r,pageNumber as c}from"./_toolkit.js";export const lspGetSemantics={name:"lspGetSemantics",description:"Typed LSP queries for semantic navigation (default type: definition).\nPrerequisites: all types except documentSymbols require symbolName + lineHint. lineHint must come from a real localSearchCode match (matches[0].line) — never guess. A wrong lineHint causes silent empty results. If lineHint is unknown: run documentSymbols (uri only) or localSearchCode first.\nType routing: documentSymbols=file outline (uri only); hover=signature+JSDoc; definition=jump to decl; typeDefinition=generic types; implementation=abstract member impl (member name, not class); references=same-package usages (bounded by the language server's open files, NOT cross-package — zero results does NOT mean unused, try callers); callers=cross-package incoming calls (TS/JS/Go/Rust only — Python/C++ use references instead); callees=outgoing calls; callHierarchy=both.\nToken efficiency: format:\"compact\" on callers/callees/callHierarchy → significantly fewer tokens. groupByFile:true on references → per-file summary with lines[] (each is a valid lineHint for follow-up calls). contextLines=3–10 on callers/callees embeds source context, reducing follow-up localGetFileContent calls.\nLanguage tiers — Tier 1 all types: TS/JS/Go/Rust. Tier 2 no callHierarchy: Python/C++. Tier 3 documentSymbols+hover+definition only: Shell/HTML/CSS/YAML/TOML.\nOutput signal: resolvedSymbol.foundAtLine confirms which line LSP resolved — if far from lineHint, re-run localSearchCode to get an accurate anchor. payload.kind='empty' means LSP returned no results (symbolNotFound → re-anchor with localSearchCode; serverUnavailable → fall back to localSearchCode). In callers/callees results, each ranges[].line is the lineHint for the next lspGetSemantics call on that symbol.\nevidence.answerReady:true — stop calling.\nNext: localGetFileContent(startLine/endLine) to read the definition; lspGetSemantics(callers) for impact analysis. Batch: up to 5 queries per call — combine definition+hover or definition+callers in one request.",schema:{uri:"Target source file as an absolute path or file:/// URI.",type:"Which query to run — see the type-routing list in the description.",symbolName:"Exact identifier sitting at lineHint — bare name only, no parentheses or type annotations (e.g. 'fetchPRDetail', not 'fetchPRDetail()'). Case-sensitive, must match the token exactly. Required for every type except documentSymbols.",lineHint:"Line where symbolName appears. Must come from a real localSearchCode match (matches[0].line) — never guess; a wrong value silently returns nothing. Required for every type except documentSymbols.",orderHint:"Disambiguates when symbolName occurs multiple times on lineHint (e.g. overloads, chained calls) — increment if you get the wrong symbol.",depth:"Recursion depth for callHierarchy/callers/callees — immediate calls only unless raised. Raise for full chains; pair high depth on hot symbols with format:'compact' to limit size.",includeDeclaration:"references: whether to include the symbol's own declaration. Set false to get only usages, not the definition site.",groupByFile:"references: returns a per-file summary (path + count + all line numbers in lines[]) instead of per-location rows — ideal for blast radius; each line is a valid lineHint for follow-ups.",page:"Result page for documentSymbols and call-flow results.",itemsPerPage:"Items per page (symbol/location lists get a larger page than call-flow results).",contextLines:"Source lines around each call site in callers/callees/callHierarchy (locations only unless set). Raise to embed calling context and skip a follow-up localGetFileContent.",format:'"structured": typed objects with full location metadata. "compact": line-oriented strings, far fewer tokens. Prefer "compact" for navigation; use "structured" only when parsing locations programmatically.',workspaceRoot:"Overrides the LSP workspace root (absolute path). Omit to auto-resolve from uri; needed only when the server spans multiple roots."}};const m={...r,uri:e.string(),symbolName:e.string(),lineHint:o(1,i),orderHint:o(0,a).default(0)};export const LSPGotoDefinitionQuerySchema=t(lspGetSemantics.schema,{...m,contextLines:n()});export const LSPFindReferencesQuerySchema=t(lspGetSemantics.schema,{...m,includeDeclaration:e.boolean().optional(),contextLines:n(),itemsPerPage:o(1,s).optional(),page:c(),groupByFile:e.boolean().optional()});export const LSPCallHierarchyQuerySchema=t(lspGetSemantics.schema,{...m,direction:e.enum(["incoming","outgoing"]),depth:o(0,l).optional(),contextLines:n(),itemsPerPage:o(1,s).optional(),page:c()});export const LspGetSemanticsQuerySchema=t(lspGetSemantics.schema,{...r,uri:e.string(),type:e.enum(["definition","references","callers","callees","callHierarchy","hover","documentSymbols","typeDefinition","implementation"]).default("definition"),symbolName:e.string().min(1).optional(),lineHint:o(1,i).optional(),orderHint:o(0,a).default(0),depth:o(0,l).optional(),includeDeclaration:e.boolean().default(!0),groupByFile:e.boolean().optional(),page:c(),itemsPerPage:o(1,s).optional(),contextLines:n(),format:e.enum(["structured","compact"]).default("structured"),workspaceRoot:e.string().optional()}).superRefine((e,t)=>{"documentSymbols"!==e.type&&(e.symbolName||t.addIssue({code:"custom",path:["symbolName"],message:"symbolName is required unless type is documentSymbols"}),Number.isInteger(e.lineHint)||t.addIssue({code:"custom",path:["lineHint"],message:"lineHint is required unless type is documentSymbols"}))});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ToolSpec } from "../../types/index.js";
|
|
3
|
+
export declare const npmSearch: ToolSpec;
|
|
4
|
+
export declare const NpmPackageQuerySchema: z.ZodObject<{
|
|
5
|
+
packageName: z.ZodString;
|
|
6
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
7
|
+
id: z.ZodOptional<z.ZodString>;
|
|
8
|
+
mainResearchGoal: z.ZodOptional<z.ZodString>;
|
|
9
|
+
researchGoal: z.ZodOptional<z.ZodString>;
|
|
10
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as e}from"zod";import{buildObject as r,metaFields as t,pageNumber as a}from"./_toolkit.js";export const npmSearch={name:"npmSearch",description:'npm package lookup and keyword search. Returns package metadata and source repository handoff.\nExact package name (e.g. "react", "@octokit/rest") returns one rich result with version, description, keywords, and repository owner/repo for GitHub handoff.\nKeyword query (e.g. "http client typescript") returns lean results — paginate with page; pagination.hasMore and totalFound available in output.\nWhen owner+repo is present in the result, pass directly to ghViewRepoStructure or ghSearchCode. If a repositoryDirectory path follows owner/repo in the result, pass it as path= to ghViewRepoStructure to scope the tree to the package subdirectory.\nSkip if owner/repo is already known — go directly to ghViewRepoStructure.\nBatch up to 5 packages in one call: queries:[{packageName:"react"},{packageName:"lodash"}].\nNext: ghViewRepoStructure or ghSearchCode when owner/repo exists; ghSearchRepos when owner/repo is absent or non-GitHub.',schema:{packageName:"An exact npm package name or a keyword query. An exact name (e.g. 'react', '@octokit/rest') returns one rich result, or empty if it doesn't exist (check spelling before assuming it's private). A keyword query returns a lean list. Scoped packages need the full scope: '@octokit/rest', not 'rest'.",page:"Page for keyword results; exact-name lookups always return page 1. Paginate while pagination.hasMore."}};export const NpmPackageQuerySchema=r(npmSearch.schema,{...t,packageName:e.string(),page:a()});
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auxiliary downstream shapes for provider mappers and finalisers.
|
|
3
|
-
* These types are too downstream-shaped to live in `src/types/index.ts`.
|
|
4
|
-
*
|
|
5
|
-
* Canonical data shapes (`LocalSearchCodeMatch`, `LocalSearchCodeFile`,
|
|
6
|
-
* `LocalFindFilesEntry`, etc.) live in `src/types/index.ts`. This file only carries:
|
|
7
|
-
* - the `BaseQuery` meta + `BaseQueryLocal`,
|
|
8
|
-
* - the *mutable, flat* `*ToolResult` envelopes built by `octocode-mcp`,
|
|
9
|
-
* - provider-mapper shapes (`GitHubRepositoryOutput`,
|
|
10
|
-
* `GitHubSearchRepositoriesData`).
|
|
11
|
-
*/
|
|
12
1
|
import type { CharPagination, LspRange, LspLocation, LspMode, PaginationInfo, LocalSearchCodeFile, LocalFindFilesEntry, GitHubRepositoryItem, GitHubPullRequestItem, GitHubSearchCodeGroup, GitHubFileContentData } from "../types/index.js";
|
|
13
2
|
export interface BaseQuery {
|
|
14
3
|
id?: string;
|
|
@@ -17,7 +6,6 @@ export interface BaseQuery {
|
|
|
17
6
|
reasoning?: string;
|
|
18
7
|
verbose?: boolean;
|
|
19
8
|
}
|
|
20
|
-
/** Local-tool flavour — adds the conventional `path` field. */
|
|
21
9
|
export interface BaseQueryLocal extends BaseQuery {
|
|
22
10
|
path?: string;
|
|
23
11
|
}
|
|
@@ -47,12 +35,6 @@ interface BaseToolResult {
|
|
|
47
35
|
error?: string;
|
|
48
36
|
errorCode?: string;
|
|
49
37
|
rawResponseChars?: number;
|
|
50
|
-
/**
|
|
51
|
-
* Index signature — `octocode-mcp`'s bulk runner threads extra
|
|
52
|
-
* fields (`data`, provider-specific blobs) through the result
|
|
53
|
-
* envelope. Keep it permissive so structural assignment to its
|
|
54
|
-
* `ProcessedBulkResult` succeeds without a cast.
|
|
55
|
-
*/
|
|
56
38
|
[key: string]: unknown;
|
|
57
39
|
}
|
|
58
40
|
export interface LocalSearchCodeToolResult extends BaseToolResult {
|
|
@@ -64,7 +46,6 @@ export interface LocalFindFilesToolResult extends BaseToolResult {
|
|
|
64
46
|
files?: LocalFindFilesEntry[];
|
|
65
47
|
pagination?: PaginationInfo;
|
|
66
48
|
}
|
|
67
|
-
/** Char-range pair carried by `LocalGetFileContentToolResult.matchRanges`. */
|
|
68
49
|
export interface MatchRange {
|
|
69
50
|
start: number;
|
|
70
51
|
end: number;
|
|
@@ -78,11 +59,6 @@ export interface LocalGetFileContentToolResult extends BaseToolResult {
|
|
|
78
59
|
endLine?: number;
|
|
79
60
|
isPartial?: boolean;
|
|
80
61
|
matchRanges?: MatchRange[];
|
|
81
|
-
/**
|
|
82
|
-
* Pagination metadata — either a char-budget paginator
|
|
83
|
-
* (`CharPagination`) for fully rendered output, or a row-counter
|
|
84
|
-
* paginator when results are paginated by line/match index.
|
|
85
|
-
*/
|
|
86
62
|
pagination?: CharPagination | PaginationInfo;
|
|
87
63
|
modified?: string;
|
|
88
64
|
lastModified?: string;
|
|
@@ -90,7 +66,6 @@ export interface LocalGetFileContentToolResult extends BaseToolResult {
|
|
|
90
66
|
filePath?: string;
|
|
91
67
|
}
|
|
92
68
|
export interface LocalViewStructureEntryFlat {
|
|
93
|
-
/** Entry display name for rich directory listings. */
|
|
94
69
|
name?: string;
|
|
95
70
|
type: "file" | "dir" | "link" | "directory" | "symlink";
|
|
96
71
|
path?: string;
|
|
@@ -100,15 +75,10 @@ export interface LocalViewStructureEntryFlat {
|
|
|
100
75
|
permissions?: string;
|
|
101
76
|
}
|
|
102
77
|
export interface LocalViewStructureToolResult extends BaseToolResult {
|
|
103
|
-
/** Rich per-entry objects — emitted with details=true or showFileLastModified=true. */
|
|
104
78
|
entries?: LocalViewStructureEntryFlat[];
|
|
105
|
-
/** Base directory for the flat name lists (lean default output). */
|
|
106
79
|
path?: string;
|
|
107
|
-
/** Flat file name list (lean default; names carry subpaths in recursive mode). */
|
|
108
80
|
files?: string[];
|
|
109
|
-
/** Flat directory name list (lean default). */
|
|
110
81
|
folders?: string[];
|
|
111
|
-
/** Flat symlink name list (lean default, only when present). */
|
|
112
82
|
links?: string[];
|
|
113
83
|
summary?: string | Record<string, unknown>;
|
|
114
84
|
pagination?: PaginationInfo;
|
|
@@ -201,12 +171,6 @@ export interface GitHubRepositoryOutput {
|
|
|
201
171
|
license?: string;
|
|
202
172
|
homepage?: string;
|
|
203
173
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Provider-facing repos-search result. Mirrors `GitHubSearchReposData`
|
|
206
|
-
* but uses `GitHubRepositoryOutput` (the structurally rich shape with
|
|
207
|
-
* `owner`/`repo` split, provider metadata) instead of the simpler
|
|
208
|
-
* `GitHubRepositoryItem`.
|
|
209
|
-
*/
|
|
210
174
|
export interface GitHubSearchRepositoriesData {
|
|
211
175
|
repositories: GitHubRepositoryOutput[];
|
|
212
176
|
pagination?: PaginationInfo;
|