@octocodeai/octocode-tools-core 18.1.2 → 18.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/README.md +113 -162
- package/dist/cacheMaintenance.d.ts +8 -0
- package/dist/direct.js +41 -51
- package/dist/github/client.d.ts +1 -1
- package/dist/github/codeSearch.d.ts +2 -2
- package/dist/github/commit.d.ts +48 -0
- package/dist/github/compare.d.ts +2 -2
- package/dist/github/directoryFetch/fetchDirectoryContents.d.ts +1 -1
- package/dist/github/directoryFetch/fetchFileContentToDisk.d.ts +1 -1
- package/dist/github/directoryFetch/refResolution.d.ts +6 -0
- package/dist/github/fileContent.d.ts +1 -1
- package/dist/github/fileContentRaw/fetch.d.ts +2 -2
- package/dist/github/githubAPI.d.ts +1 -2
- package/dist/github/history/commitFiles.d.ts +5 -0
- package/dist/github/history.d.ts +1 -1
- package/dist/github/issues/fetchers.d.ts +1 -1
- package/dist/github/issues/orchestrator.d.ts +1 -1
- package/dist/github/issues/types.d.ts +5 -0
- package/dist/github/prByNumber.d.ts +1 -1
- package/dist/github/prContentFetcher/commits.d.ts +1 -1
- package/dist/github/prContentFetcher/transform.d.ts +1 -1
- package/dist/github/pullRequestSearch.d.ts +1 -1
- package/dist/github/queryBuilders/codeAndRepo.d.ts +1 -1
- package/dist/github/repoSearch.d.ts +2 -2
- package/dist/github/repoStructure/contentResolution.d.ts +1 -1
- package/dist/github/repoStructure/fetchOrchestration.d.ts +2 -2
- package/dist/github/repoStructurePagination.d.ts +1 -1
- package/dist/graph/advancedOperations.d.ts +22 -0
- package/dist/{tools/local_dead_code/graphBuilder.d.ts → graph/buildFileGraph.d.ts} +6 -5
- package/dist/graph/cycleOperations.d.ts +12 -0
- package/dist/{tools/local_dead_code → graph}/importResolver.d.ts +1 -1
- package/dist/graph/operations.d.ts +7 -0
- package/dist/{tools/local_dead_code → graph}/reachability.d.ts +1 -1
- package/dist/{tools/local_dead_code → graph}/types.d.ts +11 -0
- package/dist/graph/workspacePackageResolver.d.ts +2 -0
- package/dist/index.d.ts +11 -30
- package/dist/index.js +45 -55
- package/dist/providers/github/githubContent.d.ts +1 -1
- package/dist/providers/github/githubPullRequests.d.ts +1 -1
- package/dist/providers/github/githubSearch.d.ts +1 -1
- package/dist/providers/github/githubStructure.d.ts +1 -1
- package/dist/providers/github/paginationMetadata.d.ts +4 -5
- package/dist/providers/providerQueries.d.ts +1 -3
- package/dist/providers/providerResults.d.ts +4 -0
- package/dist/providers/types.d.ts +1 -1
- package/dist/responses.d.ts +1 -1
- package/dist/schema.d.ts +2 -0
- package/dist/schema.js +13 -1
- package/dist/scheme/conditionalSchemas.d.ts +12 -0
- package/dist/scheme/fields.d.ts +2 -1
- package/dist/security/bridge.d.ts +7 -10
- package/dist/shared/credentials/index.js +2 -2
- package/dist/shared/paths.d.ts +1 -0
- package/dist/shared/paths.js +1 -1
- package/dist/shared/session/index.js +1 -1
- package/dist/toolContract/descriptions.d.ts +14 -0
- package/dist/toolContract/input/resources/global.d.ts +15 -0
- package/dist/toolContract/input/resources/toolRelations.d.ts +1 -0
- package/dist/toolContract/input/resources/toolVariants.d.ts +9 -0
- package/dist/toolContract/input/resources/tools/_toolkit.d.ts +75 -0
- package/dist/toolContract/input/resources/tools/ghCloneRepo.d.ts +12 -0
- package/dist/toolContract/input/resources/tools/ghGetFileContent.d.ts +30 -0
- package/dist/toolContract/input/resources/tools/ghSearch.d.ts +76 -0
- package/dist/toolContract/input/resources/tools/githubCodeOperation.d.ts +29 -0
- package/dist/toolContract/input/resources/tools/githubHistorySchema.d.ts +114 -0
- package/dist/toolContract/input/resources/tools/githubRepositoriesOperation.d.ts +54 -0
- package/dist/toolContract/input/resources/tools/githubTreeOperation.d.ts +26 -0
- package/dist/toolContract/input/resources/tools/historyCommitInput.d.ts +21 -0
- package/dist/toolContract/input/resources/tools/historyIssueInput.d.ts +59 -0
- package/dist/toolContract/input/resources/tools/historyPullRequestInput.d.ts +98 -0
- package/dist/toolContract/input/resources/tools/localAnalyzeGraph.d.ts +75 -0
- package/dist/toolContract/input/resources/tools/localFilesOperation.d.ts +70 -0
- package/dist/toolContract/input/resources/tools/localGetFileContent.d.ts +22 -0
- package/dist/toolContract/input/resources/tools/localSearch.d.ts +258 -0
- package/dist/toolContract/input/resources/tools/localTextOperation.d.ts +113 -0
- package/dist/toolContract/input/resources/tools/localTreeOperation.d.ts +44 -0
- package/dist/toolContract/input/resources/tools/lspGetSemantics.d.ts +37 -0
- package/dist/toolContract/input/resources/tools/npmSearch.d.ts +10 -0
- package/dist/toolContract/input/types/index.d.ts +24 -0
- package/dist/toolContract/metadata.d.ts +11 -0
- package/dist/toolContract/runtime.d.ts +11 -0
- package/dist/toolContract/schemas.d.ts +31 -0
- package/dist/toolContract/types.d.ts +11 -0
- package/dist/tools/directToolCatalog/toolCatalogDefinitions.d.ts +6 -16
- package/dist/tools/directToolCatalog/toolCatalogFormatters.d.ts +1 -1
- package/dist/tools/directToolCatalog/toolCommandPatternUnifiedSearchQueries.d.ts +6 -0
- package/dist/tools/directToolCatalog/toolInputPreparation.d.ts +2 -2
- package/dist/tools/directToolCatalog/toolSchemaIntrospection.d.ts +10 -0
- package/dist/tools/directToolCatalog/toolSchemaRelations.d.ts +9 -0
- package/dist/tools/directToolCatalog/toolSpecifications.d.ts +13 -0
- package/dist/tools/directToolCatalog.exec.d.ts +1 -1
- package/dist/tools/directToolCatalog.meta.d.ts +1 -0
- package/dist/tools/executionGuard.d.ts +1 -2
- package/dist/tools/github_clone_repo/cache.d.ts +1 -2
- package/dist/tools/github_clone_repo/cacheArtifacts.d.ts +3 -0
- package/dist/tools/github_clone_repo/cachePaths.d.ts +1 -1
- package/dist/tools/github_clone_repo/cloneRepo.d.ts +1 -1
- package/dist/tools/github_clone_repo/execution.d.ts +1 -1
- package/dist/tools/github_clone_repo/scheme.d.ts +24 -24
- package/dist/tools/github_fetch_content/execution.d.ts +1 -1
- package/dist/tools/github_fetch_content/finalizer/types.d.ts +19 -16
- package/dist/tools/github_fetch_content/scheme.d.ts +19 -16
- package/dist/tools/github_fetch_content/types.d.ts +4 -3
- package/dist/tools/github_search/execution.d.ts +4 -0
- package/dist/tools/github_search/finalizer.d.ts +3 -0
- package/dist/tools/github_search/scheme.d.ts +79 -0
- package/dist/tools/github_search_code/execution.d.ts +4 -2
- package/dist/tools/github_search_code/finalizer/groups.d.ts +3 -3
- package/dist/tools/github_search_code/finalizer/ranking.d.ts +1 -2
- package/dist/tools/github_search_code/scheme.d.ts +10 -16
- package/dist/tools/github_search_pull_requests/contentRequest.d.ts +1 -4
- package/dist/tools/github_search_pull_requests/contentResponse/commentsShaping.d.ts +8 -4
- package/dist/tools/github_search_pull_requests/contentResponse/fileSurfaces.d.ts +13 -10
- package/dist/tools/github_search_pull_requests/contentResponse/nextCalls.d.ts +3 -2
- package/dist/tools/github_search_pull_requests/contentResponse/pagination.d.ts +10 -3
- package/dist/tools/github_search_pull_requests/execution/commitsMode.d.ts +2 -2
- package/dist/tools/github_search_pull_requests/execution/issuesMode.d.ts +2 -2
- package/dist/tools/github_search_pull_requests/execution/pullRequestsMode.d.ts +1 -1
- package/dist/tools/github_search_pull_requests/execution.d.ts +1 -1
- package/dist/tools/github_search_pull_requests/historyContinuations.d.ts +15 -0
- package/dist/tools/github_search_pull_requests/historyExecutions.d.ts +6 -0
- package/dist/tools/github_search_pull_requests/historyPartialContinuations.d.ts +5 -0
- package/dist/tools/github_search_pull_requests/historySchemes.d.ts +58 -0
- package/dist/tools/github_search_pull_requests/historySearchPagination.d.ts +3 -0
- package/dist/tools/github_search_pull_requests/scheme.d.ts +14 -30
- package/dist/tools/github_search_pull_requests/splitExecutions.d.ts +1 -2
- package/dist/tools/github_search_pull_requests/splitSchemes.d.ts +197 -181
- package/dist/tools/github_search_repos/execution/pagination.d.ts +4 -4
- package/dist/tools/github_search_repos/execution/queryVariants.d.ts +3 -1
- package/dist/tools/github_search_repos/execution.d.ts +3 -1
- package/dist/tools/github_search_repos/scheme.d.ts +5 -7
- package/dist/tools/github_view_repo_structure/execution.d.ts +4 -2
- package/dist/tools/github_view_repo_structure/scheme.d.ts +2 -4
- package/dist/tools/github_view_repo_structure/types.d.ts +3 -0
- package/dist/tools/local_analyze_graph/analysisTypes.d.ts +46 -0
- package/dist/tools/local_analyze_graph/analyzeGraph.d.ts +3 -0
- package/dist/tools/{local_dead_code → local_analyze_graph}/deadCodeScan.d.ts +2 -1
- package/dist/tools/{local_dead_code → local_analyze_graph}/entrypoints.d.ts +1 -0
- package/dist/tools/local_analyze_graph/execution.d.ts +4 -0
- package/dist/tools/local_analyze_graph/pagination.d.ts +3 -0
- package/dist/tools/{local_dead_code → local_analyze_graph}/retention.d.ts +1 -1
- package/dist/tools/{local_dead_code → local_analyze_graph}/scheme.d.ts +31 -15
- package/dist/tools/local_fetch_content/execution.d.ts +1 -1
- package/dist/tools/local_fetch_content/scheme.d.ts +2 -4
- package/dist/tools/local_find_files/execution.d.ts +1 -1
- package/dist/tools/local_find_files/findFiles.d.ts +1 -1
- package/dist/tools/local_find_files/findFilesNext.d.ts +3 -3
- package/dist/tools/local_find_files/scheme.d.ts +6 -2
- package/dist/tools/local_ripgrep/captureBudget.d.ts +1 -0
- package/dist/tools/local_ripgrep/execution.d.ts +1 -1
- package/dist/tools/local_ripgrep/rankingProfile/rankingLexical.d.ts +20 -0
- package/dist/tools/local_ripgrep/rankingProfile/rankingResults.d.ts +1 -18
- package/dist/tools/local_ripgrep/rankingProfile.d.ts +5 -4
- package/dist/tools/local_ripgrep/ripgrepResultBuilder/searchNext.d.ts +4 -1
- package/dist/tools/local_ripgrep/scheme.d.ts +9 -7
- package/dist/tools/local_ripgrep/structuralSearch.d.ts +1 -1
- package/dist/tools/local_search/execution.d.ts +5 -0
- package/dist/tools/local_search/scheme.d.ts +260 -0
- package/dist/tools/local_view_structure/execution.d.ts +1 -1
- package/dist/tools/local_view_structure/scheme.d.ts +8 -5
- package/dist/tools/local_view_structure/viewStructureNext.d.ts +3 -3
- package/dist/tools/lsp/semantic_content/execution.d.ts +1 -1
- package/dist/tools/lsp/semantic_content/scheme.d.ts +4 -42
- package/dist/tools/lsp/semantic_content/semanticEnvelopes/envelopeHelpers.d.ts +1 -1
- package/dist/tools/lsp/semantic_content/semanticFileOps/anchor.d.ts +1 -1
- package/dist/tools/lsp/semantic_content/semanticPresentation.d.ts +0 -1
- package/dist/tools/lsp/shared/semanticTypes.d.ts +6 -3
- package/dist/tools/package_search/execution.d.ts +6 -13
- package/dist/tools/package_search/pagination.d.ts +21 -0
- package/dist/tools/package_search/queryHelpers.d.ts +3 -5
- package/dist/tools/package_search/scheme.d.ts +12 -7
- package/dist/tools/providerExecution.d.ts +3 -4
- package/dist/tools/providerMappers/codeSearch.d.ts +3 -4
- package/dist/tools/providerMappers/fileContent.d.ts +1 -2
- package/dist/tools/providerMappers/pullRequests.d.ts +6 -6
- package/dist/tools/providerMappers/repoSearch.d.ts +7 -4
- package/dist/tools/providerMappers/repoStructure.d.ts +2 -3
- package/dist/tools/toolCatalogFactory.d.ts +5 -6
- package/dist/tools/toolConfig.d.ts +6 -17
- package/dist/tools/toolMetadata/baseSchema.d.ts +1 -2
- package/dist/tools/toolMetadata/descriptions.d.ts +1 -1
- package/dist/tools/toolMetadata/names.d.ts +18 -2
- package/dist/tools/toolMetadata/state.d.ts +3 -3
- package/dist/tools/toolMetadata/types.d.ts +1 -1
- package/dist/tools/toolNames.d.ts +16 -3
- package/dist/tools/toolSchemaImports.d.ts +5 -4
- package/dist/tools/utils.d.ts +3 -6
- package/dist/types/bulk.d.ts +11 -1
- package/dist/types/execution.d.ts +6 -1
- package/dist/types/server.d.ts +0 -2
- package/dist/types/toolOutput.d.ts +10 -9
- package/dist/types/toolResults.d.ts +17 -1
- package/dist/utils/contextUtils.d.ts +4 -2
- package/dist/utils/file/toolHelpers.d.ts +1 -1
- package/dist/utils/http/cache/conditional.d.ts +9 -4
- package/dist/utils/http/cache/dataCache.d.ts +7 -2
- package/dist/utils/http/cache/diskStore.d.ts +30 -0
- package/dist/utils/http/cache/management.d.ts +5 -0
- package/dist/utils/http/cache/store.d.ts +1 -0
- package/dist/utils/http/cache/trace.d.ts +10 -0
- package/dist/utils/http/cache.d.ts +1 -0
- package/dist/utils/package/types.d.ts +5 -2
- package/dist/utils/pagination/charLimit.d.ts +0 -2
- package/dist/utils/response/bulk/pagination.d.ts +2 -1
- package/dist/utils/response/bulk/paginationDiagnostics.d.ts +2 -0
- package/dist/utils/response/bulk/queries.d.ts +0 -9
- package/dist/utils/response/bulk/response.d.ts +3 -2
- package/dist/utils/response/bulk.d.ts +1 -1
- package/dist/utils/response/callToolResult.d.ts +1 -1
- package/dist/utils/response/error.d.ts +3 -4
- package/dist/utils/response/groupedFinalizer.d.ts +2 -6
- package/dist/utils/response/normalizedError.d.ts +6 -0
- package/dist/utils/response/responseChannels.d.ts +4 -0
- package/package.json +7 -6
- package/dist/github/discussions.d.ts +0 -45
- package/dist/github/releases.d.ts +0 -45
- package/dist/scheme/responseEnvelope.d.ts +0 -88
- package/dist/tools/github_search_discussions/execution.d.ts +0 -15
- package/dist/tools/github_search_discussions/scheme.d.ts +0 -16
- package/dist/tools/github_search_pull_requests/execution/releasesMode.d.ts +0 -4
- package/dist/tools/local_dead_code/execution.d.ts +0 -4
- package/dist/tools/local_dead_code/local_dead_code.d.ts +0 -5
- package/dist/tools/local_find_files/pathPatternBraces.d.ts +0 -20
- package/dist/tools/toolMetadata/gateway.d.ts +0 -7
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { WalkResult } from '../../graph/buildFileGraph.js';
|
|
2
|
+
export type GraphOperation = 'deadCode' | 'cycles' | 'dependencies' | 'dependents' | 'path' | 'reachability';
|
|
3
|
+
export interface AnalyzeGraphQuery {
|
|
4
|
+
operation: GraphOperation;
|
|
5
|
+
path: string;
|
|
6
|
+
file?: string;
|
|
7
|
+
target?: string;
|
|
8
|
+
depth?: number;
|
|
9
|
+
entrypoints?: string[];
|
|
10
|
+
includeTests?: boolean;
|
|
11
|
+
excludeDir?: string[];
|
|
12
|
+
maxFiles?: number;
|
|
13
|
+
limit?: number;
|
|
14
|
+
page?: number;
|
|
15
|
+
pageSize?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface AnalyzeGraphOutput {
|
|
18
|
+
status?: 'empty' | 'error';
|
|
19
|
+
error?: string;
|
|
20
|
+
errorCode?: string;
|
|
21
|
+
operation: GraphOperation;
|
|
22
|
+
path: string;
|
|
23
|
+
filesScanned?: number;
|
|
24
|
+
filesSkipped?: number;
|
|
25
|
+
truncated?: boolean;
|
|
26
|
+
terminalLimit?: boolean;
|
|
27
|
+
partialReasons?: Array<'maxFiles' | 'limit' | 'filesSkipped'>;
|
|
28
|
+
totalAvailable?: number;
|
|
29
|
+
results: Array<Record<string, unknown>>;
|
|
30
|
+
summary?: Record<string, unknown>;
|
|
31
|
+
pagination?: {
|
|
32
|
+
currentPage: number;
|
|
33
|
+
totalPages: number;
|
|
34
|
+
entriesPerPage: number;
|
|
35
|
+
totalEntries: number;
|
|
36
|
+
hasMore: boolean;
|
|
37
|
+
outOfRange?: boolean;
|
|
38
|
+
};
|
|
39
|
+
next?: Record<string, unknown>;
|
|
40
|
+
warnings?: string[];
|
|
41
|
+
confidence?: 'low';
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
}
|
|
44
|
+
export interface AnalyzeGraphContext {
|
|
45
|
+
getGraph?: (path: string, excludeDir: string[], maxFiles: number) => WalkResult | Promise<WalkResult>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AnalyzeGraphContext, AnalyzeGraphOutput, AnalyzeGraphQuery } from './analysisTypes.js';
|
|
2
|
+
export declare function summarizeEntrypoints(entrypoints: string[]): Record<string, unknown>;
|
|
3
|
+
export declare function analyzeGraph(query: AnalyzeGraphQuery, context?: AnalyzeGraphContext): Promise<AnalyzeGraphOutput>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type WalkResult } from '../../graph/buildFileGraph.js';
|
|
1
2
|
import type { DeadClusterOutput, DeadExportOutput, FindDeadCodeQuery as StrictFindDeadCodeQuery } from './scheme.js';
|
|
2
3
|
import type { WithOptionalMeta } from '../../types/execution.js';
|
|
3
4
|
type FindDeadCodeQuery = WithOptionalMeta<StrictFindDeadCodeQuery>;
|
|
@@ -22,5 +23,5 @@ export interface DeadCodeScanResult {
|
|
|
22
23
|
*/
|
|
23
24
|
confidence?: 'low';
|
|
24
25
|
}
|
|
25
|
-
export declare function scanForDeadCode(rootAbsolutePath: string, query: FindDeadCodeQuery): DeadCodeScanResult
|
|
26
|
+
export declare function scanForDeadCode(rootAbsolutePath: string, query: FindDeadCodeQuery, builtGraph?: WalkResult): Promise<DeadCodeScanResult>;
|
|
26
27
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/server';
|
|
2
|
+
import type { ToolExecutionArgs } from '../../types/execution.js';
|
|
3
|
+
import { type AnalyzeGraphQuery } from './scheme.js';
|
|
4
|
+
export declare function executeAnalyzeGraph(args: ToolExecutionArgs<AnalyzeGraphQuery>): Promise<CallToolResult>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AnalyzeGraphOutput, AnalyzeGraphQuery } from './analysisTypes.js';
|
|
2
|
+
export declare function paginateGraphResults(items: Array<Record<string, unknown>>, query: AnalyzeGraphQuery): Pick<AnalyzeGraphOutput, 'results' | 'pagination' | 'truncated' | 'partialReasons' | 'totalAvailable'>;
|
|
3
|
+
export declare function finalizeGraphOutput(output: AnalyzeGraphOutput, query: AnalyzeGraphQuery, scanTruncated: boolean, why: string): AnalyzeGraphOutput;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { FindDeadCodeQuerySchema as CoreFindDeadCodeQuerySchema } from '@octocodeai/octocode-core/schemas';
|
|
3
2
|
import type { LocalItemPagination, ToolContinuation } from '../../scheme/pagination.js';
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
export
|
|
3
|
+
import { LocalAnalyzeGraphQuerySchema } from '../../toolContract/schemas.js';
|
|
4
|
+
export { LocalAnalyzeGraphQuerySchema };
|
|
5
|
+
export type AnalyzeGraphQuery = z.infer<typeof LocalAnalyzeGraphQuerySchema>;
|
|
6
|
+
export declare const LocalAnalyzeGraphBulkQuerySchema: z.ZodObject<{
|
|
7
7
|
responseCharOffset: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
8
8
|
responseCharLength: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
9
9
|
queries: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
10
|
-
}, z.core.$
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
export type GraphOperation = AnalyzeGraphQuery['operation'];
|
|
11
12
|
export type DeadCodeReason = 'unreachable-file' | 'unreferenced-export' | 'dead-cluster';
|
|
12
13
|
export interface DeadExportOutput {
|
|
13
14
|
file: string;
|
|
@@ -16,14 +17,6 @@ export interface DeadExportOutput {
|
|
|
16
17
|
line: number;
|
|
17
18
|
reason: DeadCodeReason;
|
|
18
19
|
clusterId?: number;
|
|
19
|
-
/**
|
|
20
|
-
* Only on `reason:"unreferenced-export"` — which negative-evidence path
|
|
21
|
-
* concluded "dead", so agents know which candidates to LSP-verify first:
|
|
22
|
-
* - `"reexport-chain"`: the binding IS re-exported somewhere, but every
|
|
23
|
-
* chain terminated without a real consumer — the most fragile verdict.
|
|
24
|
-
* - `"lexical-count"`: no import and no unexplained same-file occurrence
|
|
25
|
-
* beyond the declaration itself.
|
|
26
|
-
*/
|
|
27
20
|
viaHeuristic?: 'lexical-count' | 'reexport-chain';
|
|
28
21
|
}
|
|
29
22
|
export interface DeadClusterOutput {
|
|
@@ -31,6 +24,30 @@ export interface DeadClusterOutput {
|
|
|
31
24
|
files: string[];
|
|
32
25
|
reason: string;
|
|
33
26
|
}
|
|
27
|
+
export interface AnalyzeGraphOutput {
|
|
28
|
+
status?: 'empty' | 'error';
|
|
29
|
+
error?: string;
|
|
30
|
+
errorCode?: string;
|
|
31
|
+
rawResponseChars?: number;
|
|
32
|
+
operation?: GraphOperation;
|
|
33
|
+
path?: string;
|
|
34
|
+
filesScanned?: number;
|
|
35
|
+
filesSkipped?: number;
|
|
36
|
+
truncated?: boolean;
|
|
37
|
+
terminalLimit?: boolean;
|
|
38
|
+
partialReasons?: Array<'maxFiles' | 'limit' | 'filesSkipped'>;
|
|
39
|
+
totalAvailable?: number;
|
|
40
|
+
results?: Array<Record<string, unknown>>;
|
|
41
|
+
summary?: Record<string, unknown>;
|
|
42
|
+
pagination?: LocalItemPagination;
|
|
43
|
+
next?: Record<string, ToolContinuation>;
|
|
44
|
+
warnings?: string[];
|
|
45
|
+
confidence?: 'low';
|
|
46
|
+
[key: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
export type FindDeadCodeQuery = Extract<AnalyzeGraphQuery, {
|
|
49
|
+
operation: 'deadCode';
|
|
50
|
+
}> extends infer T ? T extends object ? Omit<T, 'operation'> : never : never;
|
|
34
51
|
export interface FindDeadCodeOutput {
|
|
35
52
|
status?: 'empty' | 'error';
|
|
36
53
|
error?: string;
|
|
@@ -44,8 +61,7 @@ export interface FindDeadCodeOutput {
|
|
|
44
61
|
deadClusters?: DeadClusterOutput[];
|
|
45
62
|
pagination?: LocalItemPagination;
|
|
46
63
|
next?: Record<string, ToolContinuation>;
|
|
47
|
-
/** See `DeadCodeScanResult.confidence` — present (always `"low"`) only when
|
|
48
|
-
* `entrypointsResolved` came entirely from the test-file heuristic. */
|
|
49
64
|
confidence?: 'low';
|
|
65
|
+
warnings?: string[];
|
|
50
66
|
[key: string]: unknown;
|
|
51
67
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/server';
|
|
2
2
|
import { type FetchContentQuery } from './scheme.js';
|
|
3
3
|
import type { ToolExecutionArgs } from '../../types/execution.js';
|
|
4
4
|
export declare function executeFetchContent(args: ToolExecutionArgs<FetchContentQuery>): Promise<CallToolResult>;
|
|
@@ -18,9 +18,7 @@ export declare const LocalFetchContentQuerySchema: z.ZodObject<{
|
|
|
18
18
|
standard: "standard";
|
|
19
19
|
symbols: "symbols";
|
|
20
20
|
}>>;
|
|
21
|
-
|
|
22
|
-
mainResearchGoal: z.ZodOptional<z.ZodString>;
|
|
23
|
-
researchGoal: z.ZodOptional<z.ZodString>;
|
|
21
|
+
goal: z.ZodOptional<z.ZodString>;
|
|
24
22
|
reasoning: z.ZodOptional<z.ZodString>;
|
|
25
23
|
}, z.core.$strip>;
|
|
26
24
|
export type FetchContentQuery = z.infer<typeof LocalFetchContentQuerySchema> & {
|
|
@@ -30,7 +28,7 @@ export declare const LocalFetchContentBulkQuerySchema: z.ZodObject<{
|
|
|
30
28
|
responseCharOffset: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
31
29
|
responseCharLength: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
32
30
|
queries: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
33
|
-
}, z.core.$
|
|
31
|
+
}, z.core.$strict>;
|
|
34
32
|
export interface FileContentMatchRange {
|
|
35
33
|
start: number;
|
|
36
34
|
end: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/server';
|
|
2
2
|
import { type FindFilesQuery } from './scheme.js';
|
|
3
3
|
import type { ToolExecutionArgs } from '../../types/execution.js';
|
|
4
4
|
export declare function executeFindFiles(args: ToolExecutionArgs<FindFilesQuery>): Promise<CallToolResult>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
|
-
import type { FindFilesQuerySchema } from '
|
|
2
|
+
import type { FindFilesQuerySchema } from '../../toolContract/schemas.js';
|
|
3
3
|
import type { LocalFindFilesToolResult } from '@octocodeai/octocode-core/extra-types';
|
|
4
4
|
type UpstreamFindFilesQuery = z.infer<typeof FindFilesQuerySchema>;
|
|
5
5
|
import type { WithOptionalMeta } from '../../types/execution.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LocalFindFilesEntry } from '@octocodeai/octocode-core/types';
|
|
2
2
|
type FindFilesNextCall = {
|
|
3
|
-
tool: 'localGetFileContent' | '
|
|
3
|
+
tool: 'localGetFileContent' | 'local.tree';
|
|
4
4
|
query: Record<string, unknown>;
|
|
5
5
|
why: string;
|
|
6
6
|
confidence?: 'exact' | 'high' | 'medium' | 'low';
|
|
@@ -10,7 +10,7 @@ export type FindFilesNextMap = {
|
|
|
10
10
|
viewStructure?: FindFilesNextCall;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
* Build per-result continuation hints for a
|
|
13
|
+
* Build per-result continuation hints for a local files response: point the
|
|
14
14
|
* agent at exact content for the first matched file, or into the first matched
|
|
15
15
|
* directory when the page is all directories. `nextPage` (pagination) is added
|
|
16
16
|
* separately by the caller.
|
|
@@ -20,7 +20,7 @@ export type FindFilesNextMap = {
|
|
|
20
20
|
* SKIP_TRAVERSAL_KEYS in utils/response/pathRelativize.ts), so the hint stays
|
|
21
21
|
* directly callable with no manual path conversion. Meta-free by construction:
|
|
22
22
|
* queries are built from the entry path alone, never spread from the caller
|
|
23
|
-
* query, so no auto-filled
|
|
23
|
+
* query, so no auto-filled goal/reasoning can leak in.
|
|
24
24
|
*/
|
|
25
25
|
export declare function buildFindFilesNextMap(files: readonly LocalFindFilesEntry[]): FindFilesNextMap | undefined;
|
|
26
26
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { FindFilesQuerySchema as CoreFindFilesQuerySchema } from '
|
|
2
|
+
import { FindFilesQuerySchema as CoreFindFilesQuerySchema } from '../../toolContract/schemas.js';
|
|
3
3
|
import type { LocalItemPagination, ToolContinuation } from '../../scheme/pagination.js';
|
|
4
4
|
import type { BulkToolOutput } from '../../types/toolOutput.js';
|
|
5
5
|
export type FindFilesQuery = Omit<z.infer<typeof CoreFindFilesQuerySchema>, 'regexType'>;
|
|
@@ -8,7 +8,7 @@ export declare const LocalFindFilesBulkQuerySchema: z.ZodObject<{
|
|
|
8
8
|
responseCharOffset: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
9
9
|
responseCharLength: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
10
10
|
queries: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
11
|
-
}, z.core.$
|
|
11
|
+
}, z.core.$strict>;
|
|
12
12
|
export interface LocalFindFilesEntryOutput {
|
|
13
13
|
name?: string;
|
|
14
14
|
path?: string;
|
|
@@ -24,5 +24,9 @@ export interface LocalFindFilesData {
|
|
|
24
24
|
summary?: string;
|
|
25
25
|
pagination?: LocalItemPagination;
|
|
26
26
|
next?: Record<string, ToolContinuation>;
|
|
27
|
+
terminalLimit?: boolean;
|
|
28
|
+
truncated?: boolean;
|
|
29
|
+
partialReasons?: Array<'limit' | 'walkLimit'>;
|
|
30
|
+
totalAvailable?: number;
|
|
27
31
|
}
|
|
28
32
|
export type LocalFindFilesOutput = BulkToolOutput<LocalFindFilesData>;
|
|
@@ -22,4 +22,5 @@ export type MetavarRange = {
|
|
|
22
22
|
export declare function budgetCaptures(metavars: Record<string, string[]> | undefined | null, metavarRanges: Record<string, MetavarRange[]> | undefined | null, captureText: boolean): {
|
|
23
23
|
metavars?: Record<string, string[]>;
|
|
24
24
|
metavarRanges?: Record<string, MetavarRange[]>;
|
|
25
|
+
capturesTruncated?: true;
|
|
25
26
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/server';
|
|
2
2
|
import { type RipgrepQuery } from './scheme.js';
|
|
3
3
|
import type { ToolExecutionArgs } from '../../types/execution.js';
|
|
4
4
|
export { finalizeRipgrepResult } from './ripgrepResultBuilder.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure lexical helpers shared by ranking result orchestration and scoring.
|
|
3
|
+
*
|
|
4
|
+
* This leaf module must not import either rankingResults or rankingScoring:
|
|
5
|
+
* keeping those dependencies one-way prevents ESM initialization cycles.
|
|
6
|
+
*/
|
|
7
|
+
import type { RankingProfileId } from './rankingProfiles.js';
|
|
8
|
+
export declare function matchesAny(patterns: readonly RegExp[], line: string): boolean;
|
|
9
|
+
export declare function escapeRegex(s: string): string;
|
|
10
|
+
/** A search whose keyword is a single bare identifier — the only case where
|
|
11
|
+
* whole-word/substring line-exactness is meaningful. */
|
|
12
|
+
export declare function isPlainIdentifierKeyword(keyword?: string): boolean;
|
|
13
|
+
/** Pick the line within a context snippet that actually contains the query. */
|
|
14
|
+
export declare function matchedLineOf(snippet: string, token: string | undefined, caseSensitive?: boolean): string;
|
|
15
|
+
type LexicalCategory = 'comment' | 'string' | 'code';
|
|
16
|
+
/** Conservative fallback used when grammar-accurate AST kind is unavailable. */
|
|
17
|
+
export declare function lexicalCategoryOf(line: string, token: string | undefined, profileId: RankingProfileId, caseSensitive?: boolean): LexicalCategory;
|
|
18
|
+
/** Whether byte index index falls inside a quoted region of the line. */
|
|
19
|
+
export declare function isIndexInsideString(line: string, index: number): boolean;
|
|
20
|
+
export {};
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* `../rankingProfile.ts` for the full contract.
|
|
11
11
|
*/
|
|
12
12
|
import type { LocalSearchCodeFile } from '@octocodeai/octocode-core/types';
|
|
13
|
-
import type {
|
|
13
|
+
import type { RankSort } from './rankingProfiles.js';
|
|
14
14
|
import type { FileScore, RankContext } from './rankingScoring.js';
|
|
15
15
|
export interface RankResult {
|
|
16
16
|
files: LocalSearchCodeFile[];
|
|
@@ -29,20 +29,3 @@ export declare function rankFiles(files: LocalSearchCodeFile[], sort: RankSort,
|
|
|
29
29
|
candidateCap?: number;
|
|
30
30
|
sortReverse?: boolean;
|
|
31
31
|
}): RankResult;
|
|
32
|
-
export declare function matchesAny(patterns: readonly RegExp[], line: string): boolean;
|
|
33
|
-
export declare function escapeRegex(s: string): string;
|
|
34
|
-
/** A search whose keyword is a single bare identifier — the only case where
|
|
35
|
-
* whole-word/substring line-exactness is meaningful (regex/multi-term patterns
|
|
36
|
-
* make the extracted token an arbitrary fragment). */
|
|
37
|
-
export declare function isPlainIdentifierKeyword(keyword?: string): boolean;
|
|
38
|
-
/** Pick the line within a (possibly multi-line context) snippet that actually
|
|
39
|
-
* contains the query token; fall back to the first non-empty line. */
|
|
40
|
-
export declare function matchedLineOf(snippet: string, token: string | undefined, caseSensitive?: boolean): string;
|
|
41
|
-
type LexicalCategory = 'comment' | 'string' | 'code';
|
|
42
|
-
/** Best-effort lexical category of the token's occurrence on a single line.
|
|
43
|
-
* Deterministic and conservative — used only in the regex fallback path when
|
|
44
|
-
* the engine's grammar-accurate AST kind is unavailable. */
|
|
45
|
-
export declare function lexicalCategoryOf(line: string, token: string | undefined, profileId: RankingProfileId, caseSensitive?: boolean): LexicalCategory;
|
|
46
|
-
/** Whether byte index `idx` falls inside a quoted region of the line. */
|
|
47
|
-
export declare function isIndexInsideString(line: string, idx: number): boolean;
|
|
48
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tier 1 — within-source language-aware ranking for
|
|
2
|
+
* Tier 1 — within-source language-aware ranking for local text search.
|
|
3
3
|
*
|
|
4
4
|
* Replaces "more matches first, then path" with a stable, inspectable relevance
|
|
5
5
|
* score. See `.octocode/RANKING-ARCHITECTURE.md`.
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
* tables, path-role regexes, `selectProfile`/`classifyPathRole`).
|
|
23
23
|
* - `rankingProfile/rankingScoring.ts`: the scoring engine (`bestLineScore`,
|
|
24
24
|
* `pathAffinityScore`, `candidateTermRarityScore`, `scoreFileWithRarity`).
|
|
25
|
-
* - `rankingProfile/rankingResults.ts`: `rankFiles`/`RankResult`
|
|
26
|
-
*
|
|
25
|
+
* - `rankingProfile/rankingResults.ts`: `rankFiles`/`RankResult` orchestration.
|
|
26
|
+
* - `rankingProfile/rankingLexical.ts`: shared pure lexical helpers.
|
|
27
27
|
* Re-exported here so no other module needs to change its import path.
|
|
28
28
|
*/
|
|
29
29
|
export type { RankingProfileId, RankSort, PathRole, RankingProfile, } from './rankingProfile/rankingProfiles.js';
|
|
@@ -31,4 +31,5 @@ export { RANKING_PROFILE_IDS, RANK_WEIGHTS, RANK_CANDIDATE_CAP, COMMENT_LINE, HE
|
|
|
31
31
|
export type { RankContext, FileScore, } from './rankingProfile/rankingScoring.js';
|
|
32
32
|
export { buildCandidateTermRarity, scoreFileWithRarity, scoreFile, } from './rankingProfile/rankingScoring.js';
|
|
33
33
|
export type { RankResult } from './rankingProfile/rankingResults.js';
|
|
34
|
-
export { rankFiles
|
|
34
|
+
export { rankFiles } from './rankingProfile/rankingResults.js';
|
|
35
|
+
export { matchesAny, escapeRegex, isPlainIdentifierKeyword, matchedLineOf, lexicalCategoryOf, isIndexInsideString, } from './rankingProfile/rankingLexical.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LocalSearchCodeFile } from '@octocodeai/octocode-core/types';
|
|
2
2
|
import type { RipgrepQuery } from '../scheme.js';
|
|
3
3
|
import type { LocalSearchEngine } from './buildResult.js';
|
|
4
|
-
type NextToolName = 'localGetFileContent' | 'lspGetSemantics' | '
|
|
4
|
+
type NextToolName = 'localGetFileContent' | 'lspGetSemantics' | 'local.text';
|
|
5
5
|
type NextConfidence = 'exact' | 'low';
|
|
6
6
|
type SearchNextCall = {
|
|
7
7
|
tool: NextToolName;
|
|
@@ -15,6 +15,8 @@ export type SearchNextMap = {
|
|
|
15
15
|
lspReferences?: SearchNextCall;
|
|
16
16
|
nextPage?: SearchNextCall;
|
|
17
17
|
nextMatchPage?: SearchNextCall;
|
|
18
|
+
expandScan?: SearchNextCall;
|
|
19
|
+
expandCaptures?: SearchNextCall;
|
|
18
20
|
};
|
|
19
21
|
type FlowMatch = {
|
|
20
22
|
line?: number;
|
|
@@ -24,6 +26,7 @@ type FlowMatch = {
|
|
|
24
26
|
metavarRanges?: Record<string, Array<{
|
|
25
27
|
line: number;
|
|
26
28
|
}>>;
|
|
29
|
+
capturesTruncated?: boolean;
|
|
27
30
|
};
|
|
28
31
|
export declare function buildSearchNextMap(files: LocalSearchCodeFile[], query: RipgrepQuery, searchEngine: LocalSearchEngine, options: {
|
|
29
32
|
isFileListMode: boolean;
|
|
@@ -5,10 +5,10 @@ export declare const LocalRipgrepQuerySchema: z.ZodObject<{
|
|
|
5
5
|
searchText: z.ZodOptional<z.ZodString>;
|
|
6
6
|
path: z.ZodString;
|
|
7
7
|
mode: z.ZodDefault<z.ZodEnum<{
|
|
8
|
+
structural: "structural";
|
|
8
9
|
paginated: "paginated";
|
|
9
10
|
discovery: "discovery";
|
|
10
11
|
detailed: "detailed";
|
|
11
|
-
structural: "structural";
|
|
12
12
|
}>>;
|
|
13
13
|
pattern: z.ZodOptional<z.ZodString>;
|
|
14
14
|
rule: z.ZodOptional<z.ZodString>;
|
|
@@ -33,6 +33,7 @@ export declare const LocalRipgrepQuerySchema: z.ZodObject<{
|
|
|
33
33
|
matchContentLength: z.ZodDefault<z.ZodNumber>;
|
|
34
34
|
maxMatchesPerFile: z.ZodOptional<z.ZodNumber>;
|
|
35
35
|
maxFiles: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
36
37
|
multiline: z.ZodDefault<z.ZodEnum<{
|
|
37
38
|
off: "off";
|
|
38
39
|
on: "on";
|
|
@@ -48,8 +49,8 @@ export declare const LocalRipgrepQuerySchema: z.ZodObject<{
|
|
|
48
49
|
}>>;
|
|
49
50
|
sortReverse: z.ZodOptional<z.ZodBoolean>;
|
|
50
51
|
rankingProfile: z.ZodDefault<z.ZodEnum<{
|
|
51
|
-
auto: "auto";
|
|
52
52
|
typescript: "typescript";
|
|
53
|
+
auto: "auto";
|
|
53
54
|
javascript: "javascript";
|
|
54
55
|
rust: "rust";
|
|
55
56
|
python: "python";
|
|
@@ -72,17 +73,15 @@ export declare const LocalRipgrepQuerySchema: z.ZodObject<{
|
|
|
72
73
|
matchOnly: "matchOnly";
|
|
73
74
|
}>>;
|
|
74
75
|
unique: z.ZodDefault<z.ZodEnum<{
|
|
76
|
+
count: "count";
|
|
75
77
|
list: "list";
|
|
76
78
|
off: "off";
|
|
77
|
-
count: "count";
|
|
78
79
|
}>>;
|
|
79
80
|
matchWindow: z.ZodOptional<z.ZodNumber>;
|
|
80
81
|
matchPage: z.ZodOptional<z.ZodNumber>;
|
|
81
82
|
itemsPerPage: z.ZodOptional<z.ZodNumber>;
|
|
82
83
|
page: z.ZodDefault<z.ZodNumber>;
|
|
83
|
-
|
|
84
|
-
mainResearchGoal: z.ZodOptional<z.ZodString>;
|
|
85
|
-
researchGoal: z.ZodOptional<z.ZodString>;
|
|
84
|
+
goal: z.ZodOptional<z.ZodString>;
|
|
86
85
|
reasoning: z.ZodOptional<z.ZodString>;
|
|
87
86
|
}, z.core.$strip>;
|
|
88
87
|
export type RipgrepQuery = z.infer<typeof LocalRipgrepQuerySchema>;
|
|
@@ -90,7 +89,7 @@ export declare const LocalRipgrepBulkQuerySchema: z.ZodObject<{
|
|
|
90
89
|
responseCharOffset: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
91
90
|
responseCharLength: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
92
91
|
queries: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
93
|
-
}, z.core.$
|
|
92
|
+
}, z.core.$strict>;
|
|
94
93
|
export interface LocalSearchMatch {
|
|
95
94
|
line: number;
|
|
96
95
|
endLine?: number;
|
|
@@ -145,5 +144,8 @@ export interface LocalSearchCodeData {
|
|
|
145
144
|
};
|
|
146
145
|
pagination?: LocalItemPagination;
|
|
147
146
|
next?: Record<string, ToolContinuation>;
|
|
147
|
+
terminalLimit?: boolean;
|
|
148
|
+
truncated?: boolean;
|
|
149
|
+
partialReasons?: Array<'maxFiles'>;
|
|
148
150
|
}
|
|
149
151
|
export type LocalSearchCodeOutput = BulkToolOutput<LocalSearchCodeData>;
|
|
@@ -2,7 +2,7 @@ import type { LocalSearchCodeToolResult } from '@octocodeai/octocode-core/extra-
|
|
|
2
2
|
import type { RipgrepQuery } from './scheme.js';
|
|
3
3
|
/**
|
|
4
4
|
* mode:"structural" execution path. Path validation and result shaping stay in
|
|
5
|
-
* TypeScript with the rest of
|
|
5
|
+
* TypeScript with the rest of local text search; filesystem traversal, file reads,
|
|
6
6
|
* pre-filtering, parsing, and Octocode AST matching run in native Rust.
|
|
7
7
|
*/
|
|
8
8
|
export declare function searchContentStructural(query: RipgrepQuery): Promise<LocalSearchCodeToolResult>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/server';
|
|
2
|
+
import type { ToolExecutionArgs } from '../../types/execution.js';
|
|
3
|
+
import { type LocalSearchQuery } from './scheme.js';
|
|
4
|
+
export { LOCAL_SEARCH_TOOL_NAME } from '../toolNames.js';
|
|
5
|
+
export declare function executeLocalSearch(args: ToolExecutionArgs<LocalSearchQuery>): Promise<CallToolResult>;
|