@octocodeai/octocode-tools-core 16.6.2 → 17.0.1
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 +29 -55
- package/dist/direct.js +34 -36
- package/dist/github/botFilter.d.ts +1 -0
- package/dist/github/client.d.ts +6 -0
- package/dist/github/directoryFetch/fetchDirectoryContents.d.ts +3 -0
- package/dist/github/directoryFetch/fetchFileContentToDisk.d.ts +3 -0
- package/dist/github/directoryFetch/helpers.d.ts +35 -0
- package/dist/github/directoryFetch.d.ts +3 -6
- package/dist/github/fileContentPagination.d.ts +9 -0
- package/dist/github/fileContentProcess.d.ts +1 -8
- package/dist/github/fileContentRaw/fetch.d.ts +20 -0
- package/dist/github/fileContentRaw/pathSuggestions.d.ts +3 -0
- package/dist/github/fileContentRaw.d.ts +2 -12
- package/dist/github/githubAPI.d.ts +4 -1
- package/dist/github/history.d.ts +6 -2
- package/dist/github/issues/fetchers.d.ts +7 -0
- package/dist/github/issues/helpers.d.ts +32 -0
- package/dist/github/issues/orchestrator.d.ts +4 -0
- package/dist/github/issues/types.d.ts +72 -0
- package/dist/github/issues.d.ts +3 -0
- package/dist/github/prContentFetcher/comments.d.ts +11 -0
- package/dist/github/prContentFetcher/commits.d.ts +27 -0
- package/dist/github/prContentFetcher/flags.d.ts +21 -0
- package/dist/github/prContentFetcher/transform.d.ts +5 -0
- package/dist/github/prContentFetcher.d.ts +2 -5
- package/dist/github/pullRequestSearch/restSearch.d.ts +6 -0
- package/dist/github/pullRequestSearch.d.ts +1 -0
- package/dist/github/queryBuilders/base.d.ts +25 -0
- package/dist/github/queryBuilders/codeAndRepo.d.ts +20 -0
- package/dist/github/queryBuilders/issues.d.ts +42 -0
- package/dist/github/queryBuilders/pullRequests.d.ts +13 -0
- package/dist/github/queryBuilders.d.ts +4 -12
- package/dist/github/releases.d.ts +37 -0
- package/dist/github/repoStructure/contentResolution.d.ts +12 -0
- package/dist/github/repoStructure/fetchOrchestration.d.ts +7 -0
- package/dist/github/repoStructure/resultBuilder.d.ts +22 -0
- package/dist/github/repoStructure.d.ts +1 -7
- package/dist/github/repoStructureTree.d.ts +38 -0
- package/dist/github/responseHeaders.d.ts +2 -0
- package/dist/github/searchKeyword.d.ts +2 -0
- package/dist/index.d.ts +6 -7
- package/dist/index.js +36 -45
- package/dist/oql/adapters/github/execute.d.ts +16 -0
- package/dist/oql/adapters/github/provider-diagnostics.d.ts +14 -0
- package/dist/oql/adapters/github/shared.d.ts +75 -0
- package/dist/oql/adapters/github.d.ts +11 -0
- package/dist/oql/adapters/graphProof.d.ts +6 -0
- package/dist/oql/adapters/graphView/filters.d.ts +25 -0
- package/dist/oql/adapters/graphView/nativeEdges.d.ts +5 -0
- package/dist/oql/adapters/graphView.d.ts +29 -0
- package/dist/oql/adapters/local/code.d.ts +3 -0
- package/dist/oql/adapters/local/codeBoolean.d.ts +3 -0
- package/dist/oql/adapters/local/fileRowOps.d.ts +11 -0
- package/dist/oql/adapters/local/files.d.ts +3 -0
- package/dist/oql/adapters/local/filesBoolean.d.ts +10 -0
- package/dist/oql/adapters/local/filesContentLeaf.d.ts +12 -0
- package/dist/oql/adapters/local/filesUniverse.d.ts +6 -0
- package/dist/oql/adapters/local/findToolType.d.ts +10 -0
- package/dist/oql/adapters/local/predicates.d.ts +18 -0
- package/dist/oql/adapters/local/scope.d.ts +14 -0
- package/dist/oql/adapters/local/searchToolType.d.ts +7 -0
- package/dist/oql/adapters/local/structureContent.d.ts +6 -0
- package/dist/oql/adapters/local/types.d.ts +34 -0
- package/dist/oql/adapters/local.d.ts +3 -7
- package/dist/oql/adapters/researchTargets/diff.d.ts +16 -0
- package/dist/oql/adapters/researchTargets/graph.d.ts +3 -0
- package/dist/oql/adapters/researchTargets/history.d.ts +20 -0
- package/dist/oql/adapters/researchTargets/pagination.d.ts +54 -0
- package/dist/oql/adapters/researchTargets/repositories.d.ts +4 -0
- package/dist/oql/adapters/researchTargets/research.d.ts +3 -0
- package/dist/oql/adapters/researchTargets/rows.d.ts +16 -0
- package/dist/oql/adapters/researchTargets/semantics.d.ts +3 -0
- package/dist/oql/adapters/researchTargets/shared.d.ts +11 -0
- package/dist/oql/adapters/researchTargets.d.ts +4 -46
- package/dist/oql/adapters/resultMap.d.ts +7 -0
- package/dist/oql/adapters/runner.d.ts +7 -0
- package/dist/oql/defaults.d.ts +1 -1
- package/dist/oql/index.js +35 -37
- package/dist/oql/normalize/batch.d.ts +2 -0
- package/dist/oql/normalize/materialize.d.ts +2 -0
- package/dist/oql/normalize/params.d.ts +2 -0
- package/dist/oql/normalize/query.d.ts +2 -0
- package/dist/oql/normalize/scope.d.ts +2 -0
- package/dist/oql/normalize/shared.d.ts +7 -0
- package/dist/oql/normalize/source.d.ts +2 -0
- package/dist/oql/normalize/where.d.ts +2 -0
- package/dist/oql/normalize.d.ts +19 -4
- package/dist/oql/planner/planDiagnostics.d.ts +13 -0
- package/dist/oql/planner/predicateRouting.d.ts +35 -0
- package/dist/oql/predicateUtils.d.ts +3 -0
- package/dist/oql/research/analyze/manifest-scan.d.ts +4 -0
- package/dist/oql/research/analyze/source-graph.d.ts +7 -0
- package/dist/oql/research/analyze/symbol-scoring.d.ts +4 -0
- package/dist/oql/research/analyze/types.d.ts +163 -0
- package/dist/oql/research/analyze/utils.d.ts +16 -0
- package/dist/oql/research/analyze.d.ts +2 -133
- package/dist/oql/research/packets/builders.d.ts +4 -0
- package/dist/oql/research/packets/types.d.ts +91 -0
- package/dist/oql/research/packets.d.ts +21 -80
- package/dist/oql/run/batch.d.ts +3 -0
- package/dist/oql/run/continuations/records.d.ts +19 -0
- package/dist/oql/run/continuations/registry.d.ts +22 -0
- package/dist/oql/run/continuations/semantics.d.ts +3 -0
- package/dist/oql/run/continuations/types.d.ts +12 -0
- package/dist/oql/run/dryRun.d.ts +11 -0
- package/dist/oql/run/paths.d.ts +15 -0
- package/dist/oql/run/proofGrades.d.ts +8 -0
- package/dist/oql/run/select.d.ts +10 -0
- package/dist/oql/run/single.d.ts +22 -0
- package/dist/oql/run.d.ts +4 -31
- package/dist/oql/schema/predicates.d.ts +12 -0
- package/dist/oql/schema.d.ts +74 -43
- package/dist/oql/schemeText.d.ts +21 -23
- package/dist/oql/shorthand/predicates.d.ts +15 -0
- package/dist/oql/shorthand/query-controls.d.ts +18 -0
- package/dist/oql/shorthand/target-params.d.ts +9 -0
- package/dist/oql/shorthand/types.d.ts +159 -0
- package/dist/oql/shorthand/utils.d.ts +7 -0
- package/dist/oql/shorthand.d.ts +2 -171
- package/dist/oql/targetParams.d.ts +0 -13
- package/dist/oql/transformers/github/code.d.ts +1 -9
- package/dist/oql/transformers/github/common.d.ts +7 -1
- package/dist/oql/types/diagnostics.d.ts +22 -0
- package/dist/oql/types/envelope.d.ts +78 -0
- package/dist/oql/types/guards.d.ts +9 -0
- package/dist/oql/types/planner.d.ts +46 -0
- package/dist/oql/types/predicates.d.ts +93 -0
- package/dist/oql/types/query.d.ts +143 -0
- package/dist/oql/types/recordData.d.ts +127 -0
- package/dist/oql/types/recordRows.d.ts +48 -0
- package/dist/oql/types/results.d.ts +118 -0
- package/dist/oql/types/targets.d.ts +22 -0
- package/dist/oql/types.d.ts +17 -630
- package/dist/providers/github/paginationMetadata.d.ts +12 -0
- package/dist/providers/providerResults.d.ts +0 -1
- package/dist/responses.d.ts +4 -35
- package/dist/schema.js +2 -2
- package/dist/scheme/pagination.d.ts +116 -0
- package/dist/scheme/responseEnvelope.d.ts +67 -1
- package/dist/shared/config/index.d.ts +1 -8
- package/dist/shared/config/index.js +1 -2
- package/dist/shared/credentials/index.d.ts +1 -1
- package/dist/shared/credentials/index.js +2 -1
- package/dist/shared/credentials/storage.d.ts +0 -2
- package/dist/shared/credentials/testing.js +1 -1
- package/dist/shared/languageSelectors/classify.d.ts +15 -0
- package/dist/shared/languageSelectors/data.d.ts +12 -0
- package/dist/shared/languageSelectors.d.ts +3 -23
- package/dist/shared/paths.d.ts +4 -4
- package/dist/shared/paths.js +1 -1
- package/dist/shared/session/index.js +1 -1
- package/dist/shared/session/statsDefaults.d.ts +1 -2
- package/dist/tools/directToolCatalog/toolCatalogDefinitions.d.ts +68 -0
- package/dist/tools/directToolCatalog/toolCommandPatternQueries.d.ts +4 -0
- package/dist/tools/directToolCatalog/toolCommandPatterns.d.ts +4 -0
- package/dist/tools/directToolCatalog/toolInputPreparation.d.ts +12 -0
- package/dist/tools/directToolCatalog/toolSchemaIntrospection.d.ts +19 -0
- package/dist/tools/directToolCatalog.exec.d.ts +5 -0
- package/dist/tools/directToolCatalog.meta.d.ts +10 -67
- package/dist/tools/github_clone_repo/cache.d.ts +1 -5
- package/dist/tools/github_clone_repo/cachePaths.d.ts +5 -0
- package/dist/tools/github_clone_repo/scheme.d.ts +0 -1
- package/dist/tools/github_fetch_content/finalizer/entryParsers.d.ts +9 -0
- package/dist/tools/github_fetch_content/finalizer/types.d.ts +101 -0
- package/dist/tools/github_fetch_content/finalizer.d.ts +1 -7
- package/dist/tools/github_fetch_content/scheme.d.ts +43 -9
- package/dist/tools/github_fetch_content/types.d.ts +1 -2
- package/dist/tools/github_search_code/execution.d.ts +9 -0
- package/dist/tools/github_search_code/finalizer/build.d.ts +4 -0
- package/dist/tools/github_search_code/finalizer/groups.d.ts +23 -0
- package/dist/tools/github_search_code/finalizer/ranking.d.ts +12 -0
- package/dist/tools/github_search_code/finalizer.d.ts +2 -6
- package/dist/tools/github_search_code/scheme.d.ts +31 -6
- package/dist/tools/github_search_pull_requests/contentResponse/commentsShaping.d.ts +68 -0
- package/dist/tools/github_search_pull_requests/contentResponse/fileSurfaces.d.ts +52 -0
- package/dist/tools/github_search_pull_requests/contentResponse/nextCalls.d.ts +17 -0
- package/dist/tools/github_search_pull_requests/contentResponse/pagination.d.ts +63 -0
- package/dist/tools/github_search_pull_requests/contentResponse.d.ts +1 -15
- package/dist/tools/github_search_pull_requests/execution/commitsMode.d.ts +4 -0
- package/dist/tools/github_search_pull_requests/execution/issuesMode.d.ts +4 -0
- package/dist/tools/github_search_pull_requests/execution/pullRequestsMode.d.ts +4 -0
- package/dist/tools/github_search_pull_requests/execution/releasesMode.d.ts +4 -0
- package/dist/tools/github_search_pull_requests/execution/types.d.ts +6 -0
- package/dist/tools/github_search_pull_requests/execution.d.ts +1 -4
- package/dist/tools/github_search_pull_requests/scheme.d.ts +11 -2
- package/dist/tools/github_search_repos/execution/pagination.d.ts +39 -0
- package/dist/tools/github_search_repos/execution/queryVariants.d.ts +38 -0
- package/dist/tools/github_search_repos/execution/ranking.d.ts +4 -0
- package/dist/tools/github_search_repos/execution.d.ts +3 -13
- package/dist/tools/github_search_repos/scheme.d.ts +7 -2
- package/dist/tools/github_view_repo_structure/scheme.d.ts +0 -1
- package/dist/tools/github_view_repo_structure/types.d.ts +2 -0
- package/dist/tools/local_fetch_content/fetchContent/extraction.d.ts +15 -0
- package/dist/tools/local_fetch_content/fetchContent/pagination.d.ts +38 -0
- package/dist/tools/local_fetch_content/fetchContent/validation.d.ts +26 -0
- package/dist/tools/local_fetch_content/fetchContent.d.ts +2 -0
- package/dist/tools/local_fetch_content/scheme.d.ts +90 -0
- package/dist/tools/local_find_files/scheme.d.ts +81 -0
- package/dist/tools/local_ripgrep/rankingProfile/rankingProfiles.d.ts +70 -0
- package/dist/tools/local_ripgrep/rankingProfile/rankingResults.d.ts +47 -0
- package/dist/tools/local_ripgrep/rankingProfile/rankingScoring.d.ts +41 -0
- package/dist/tools/local_ripgrep/rankingProfile.d.ts +16 -95
- package/dist/tools/local_ripgrep/ripgrepResultBuilder/buildResult.d.ts +10 -0
- package/dist/tools/local_ripgrep/ripgrepResultBuilder/searchNext.d.ts +46 -0
- package/dist/tools/local_ripgrep/ripgrepResultBuilder.d.ts +2 -18
- package/dist/tools/local_ripgrep/scheme.d.ts +170 -0
- package/dist/tools/local_view_structure/scheme.d.ts +83 -0
- package/dist/tools/lsp/semantic_content/scheme.d.ts +56 -8
- package/dist/tools/lsp/semantic_content/semanticAnchored.d.ts +7 -0
- package/dist/tools/lsp/semantic_content/semanticEnvelopes/callEnvelopes.d.ts +5 -0
- package/dist/tools/lsp/semantic_content/semanticEnvelopes/envelopeHelpers.d.ts +20 -0
- package/dist/tools/lsp/semantic_content/semanticEnvelopes/locationEnvelopes.d.ts +13 -0
- package/dist/tools/lsp/semantic_content/semanticEnvelopes.d.ts +3 -0
- package/dist/tools/lsp/semantic_content/semanticFileOps/anchor.d.ts +24 -0
- package/dist/tools/lsp/semantic_content/semanticFileOps/documentSymbols.d.ts +27 -0
- package/dist/tools/lsp/semantic_content/semanticFileOps/workspaceSymbolsAndDiagnostics.d.ts +20 -0
- package/dist/tools/lsp/semantic_content/semanticFileOps.d.ts +8 -0
- package/dist/tools/lsp/semantic_content/semanticPresentation.d.ts +53 -0
- package/dist/tools/lsp/shared/readiness.d.ts +17 -0
- package/dist/tools/lsp/shared/semanticTypes.d.ts +6 -0
- package/dist/tools/package_search/execution.d.ts +8 -0
- package/dist/tools/package_search/scheme.d.ts +45 -6
- package/dist/tools/providerMappers/codeSearch.d.ts +66 -0
- package/dist/tools/providerMappers/fileContent.d.ts +28 -0
- package/dist/tools/providerMappers/pullRequests.d.ts +158 -0
- package/dist/tools/providerMappers/repoSearch.d.ts +30 -0
- package/dist/tools/providerMappers/repoStructure.d.ts +20 -0
- package/dist/tools/providerMappers/shared.d.ts +23 -0
- package/dist/tools/providerMappers.d.ts +9 -294
- package/dist/tools/toolConfig.d.ts +0 -2
- package/dist/tools/toolMetadata/descriptionOverrides.d.ts +4 -0
- package/dist/tools/toolNames.d.ts +1 -0
- package/dist/tools/toolSchemaImports.d.ts +13 -0
- package/dist/utils/contextUtils.d.ts +5 -16
- package/dist/utils/core/types.d.ts +2 -24
- package/dist/utils/exec/spawn/env.d.ts +5 -0
- package/dist/utils/exec/spawn/wrappers.d.ts +29 -0
- package/dist/utils/exec/spawn.d.ts +2 -34
- package/dist/utils/http/cache/conditional.d.ts +21 -0
- package/dist/utils/http/cache/dataCache.d.ts +6 -0
- package/dist/utils/http/cache/key.d.ts +1 -0
- package/dist/utils/http/cache/management.d.ts +9 -0
- package/dist/utils/http/cache/store.d.ts +28 -0
- package/dist/utils/http/cache.d.ts +4 -16
- package/dist/utils/markdownOutline.d.ts +0 -2
- package/dist/utils/package/npm/npmDeprecation.d.ts +5 -0
- package/dist/utils/package/npm/npmDetailsFetchers.d.ts +15 -0
- package/dist/utils/package/npm/npmMappers.d.ts +12 -0
- package/dist/utils/package/npm/npmRegistry.d.ts +79 -0
- package/dist/utils/package/npm/npmSearchStrategies.d.ts +6 -0
- package/dist/utils/package/npm.d.ts +2 -8
- package/dist/utils/pagination/boundary.d.ts +5 -5
- package/dist/utils/response/bulk/pagination.d.ts +6 -0
- package/dist/utils/response/bulk/queries.d.ts +19 -0
- package/dist/utils/response/bulk/response.d.ts +4 -0
- package/dist/utils/response/bulk.d.ts +2 -5
- package/dist/utils/response/groupedFinalizer.d.ts +7 -2
- package/package.json +10 -3
- package/dist/oql/adapters/v2.d.ts +0 -32
- package/dist/oql/v2params.d.ts +0 -22
- package/dist/shared/config/defaults.d.ts +0 -14
- package/dist/shared/config/loader.d.ts +0 -7
- package/dist/shared/config/resolver.d.ts +0 -2
- package/dist/shared/config/resolverCache.d.ts +0 -12
- package/dist/shared/config/resolverSections.d.ts +0 -10
- package/dist/shared/config/runtimeSurface.d.ts +0 -22
- package/dist/shared/config/types.d.ts +0 -92
- package/dist/shared/config/validator.d.ts +0 -2
- package/dist/shared/credentials/envTokens.d.ts +0 -9
- package/dist/tools/local_binary_inspect/archiveOps.d.ts +0 -24
- package/dist/tools/local_binary_inspect/binaryInspector.d.ts +0 -86
- package/dist/tools/local_binary_inspect/binaryOps.d.ts +0 -27
- package/dist/tools/local_binary_inspect/decompressOps.d.ts +0 -16
- package/dist/tools/local_binary_inspect/execution.d.ts +0 -4
- package/dist/tools/local_binary_inspect/scheme.d.ts +0 -47
- package/dist/tools/local_ripgrep/lspBoost.d.ts +0 -54
- package/dist/utils/parsers/ripgrep.d.ts +0 -11
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { RepoSearchVariantExecution, RepoSearchVariantLabel, SuccessfulRepoSearchVariant } from './queryVariants.js';
|
|
2
|
+
export declare function buildResultPagination(pagination: {
|
|
3
|
+
currentPage: number;
|
|
4
|
+
totalPages: number;
|
|
5
|
+
hasMore: boolean;
|
|
6
|
+
entriesPerPage?: number;
|
|
7
|
+
totalMatches?: number;
|
|
8
|
+
reportedTotalMatches?: number;
|
|
9
|
+
reachableTotalMatches?: number;
|
|
10
|
+
totalMatchesKind?: 'exact' | 'reported' | 'lowerBound';
|
|
11
|
+
totalMatchesCapped?: boolean;
|
|
12
|
+
}): {
|
|
13
|
+
nextPage?: number;
|
|
14
|
+
hasMore: boolean;
|
|
15
|
+
totalMatchesCapped?: boolean;
|
|
16
|
+
totalMatchesKind?: "exact" | "reported" | "lowerBound";
|
|
17
|
+
reachableTotalMatches?: number;
|
|
18
|
+
reportedTotalMatches?: number;
|
|
19
|
+
totalMatches?: number;
|
|
20
|
+
currentPage: number;
|
|
21
|
+
totalPages: number;
|
|
22
|
+
perPage: number;
|
|
23
|
+
};
|
|
24
|
+
export type EffectivePagination = {
|
|
25
|
+
currentPage: number;
|
|
26
|
+
totalPages: number;
|
|
27
|
+
hasMore: boolean;
|
|
28
|
+
entriesPerPage?: number;
|
|
29
|
+
totalMatches?: number;
|
|
30
|
+
reportedTotalMatches?: number;
|
|
31
|
+
reachableTotalMatches?: number;
|
|
32
|
+
totalMatchesKind?: 'exact' | 'reported' | 'lowerBound';
|
|
33
|
+
totalMatchesCapped?: boolean;
|
|
34
|
+
};
|
|
35
|
+
export declare function buildPartialFailureWarnings(failedVariants: readonly {
|
|
36
|
+
label: RepoSearchVariantLabel;
|
|
37
|
+
}[]): string[] | undefined;
|
|
38
|
+
export declare function buildMergedPagination(variants: SuccessfulRepoSearchVariant[], dedupedCount: number): EffectivePagination | undefined;
|
|
39
|
+
export declare function sumVariantRawResponseChars(variants: RepoSearchVariantExecution[]): number;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { GitHubReposSearchSingleQuerySchema } from '@octocodeai/octocode-core/schemas';
|
|
3
|
+
import type { RepoSearchResult as ProviderRepoSearchResult } from '../../../providers/types.js';
|
|
4
|
+
import type { ProviderOperationResult } from '../../providerExecution.js';
|
|
5
|
+
import type { WithOptionalMeta } from '../../../types/execution.js';
|
|
6
|
+
type GitHubReposSearchSingleQuery = z.infer<typeof GitHubReposSearchSingleQuerySchema>;
|
|
7
|
+
export type RepositorySearchExtraFields = {
|
|
8
|
+
archived?: boolean;
|
|
9
|
+
visibility?: 'public' | 'private';
|
|
10
|
+
forks?: string;
|
|
11
|
+
license?: string;
|
|
12
|
+
goodFirstIssues?: string;
|
|
13
|
+
};
|
|
14
|
+
export type PartialReposSearchQuery = WithOptionalMeta<GitHubReposSearchSingleQuery> & RepositorySearchExtraFields;
|
|
15
|
+
export type RepoSearchVariantLabel = 'combined' | 'topics' | 'keywords';
|
|
16
|
+
export interface RepoSearchVariant {
|
|
17
|
+
label: RepoSearchVariantLabel;
|
|
18
|
+
query: PartialReposSearchQuery;
|
|
19
|
+
}
|
|
20
|
+
export interface RepoSearchVariantExecution {
|
|
21
|
+
label: RepoSearchVariantLabel;
|
|
22
|
+
query: PartialReposSearchQuery;
|
|
23
|
+
response: ProviderOperationResult<RepoSearchVariant, ProviderRepoSearchResult>['response'];
|
|
24
|
+
}
|
|
25
|
+
export type SuccessfulRepoSearchVariant = RepoSearchVariantExecution & {
|
|
26
|
+
response: Extract<ProviderOperationResult<RepoSearchVariant, ProviderRepoSearchResult>, {
|
|
27
|
+
response: {
|
|
28
|
+
data: ProviderRepoSearchResult;
|
|
29
|
+
};
|
|
30
|
+
}>['response'] & {
|
|
31
|
+
data: ProviderRepoSearchResult;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare function hasValidTopics(query: PartialReposSearchQuery): boolean;
|
|
35
|
+
export declare function hasValidKeywords(query: PartialReposSearchQuery): boolean;
|
|
36
|
+
export declare function hasValidRepositorySearchParams(query: PartialReposSearchQuery): boolean;
|
|
37
|
+
export declare function createSearchVariants(query: PartialReposSearchQuery): RepoSearchVariant[];
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GitHubRepositoryOutput } from '@octocodeai/octocode-core/extra-types';
|
|
2
|
+
import type { PartialReposSearchQuery } from './queryVariants.js';
|
|
3
|
+
export declare function deduplicateRepositories(repositories: GitHubRepositoryOutput[]): GitHubRepositoryOutput[];
|
|
4
|
+
export declare function rankRepositoriesByRelevance(repositories: readonly GitHubRepositoryOutput[], query: PartialReposSearchQuery): GitHubRepositoryOutput[];
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import { type CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
-
import type { z } from 'zod';
|
|
3
|
-
import type { GitHubReposSearchSingleQuerySchema } from '@octocodeai/octocode-core/schemas';
|
|
4
2
|
import type { GitHubRepositoryOutput } from '@octocodeai/octocode-core/extra-types';
|
|
5
|
-
type
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
archived?: boolean;
|
|
9
|
-
visibility?: 'public' | 'private';
|
|
10
|
-
forks?: string;
|
|
11
|
-
license?: string;
|
|
12
|
-
goodFirstIssues?: string;
|
|
13
|
-
};
|
|
14
|
-
type PartialReposSearchQuery = WithOptionalMeta<GitHubReposSearchSingleQuery> & RepositorySearchExtraFields;
|
|
3
|
+
import type { ToolExecutionArgs } from '../../types/execution.js';
|
|
4
|
+
import { type PartialReposSearchQuery } from './execution/queryVariants.js';
|
|
5
|
+
export { buildMergedPagination, buildPartialFailureWarnings, buildResultPagination, } from './execution/pagination.js';
|
|
15
6
|
export declare function formatRepoLine(repo: GitHubRepositoryOutput): string;
|
|
16
7
|
export declare function searchMultipleGitHubRepos(args: ToolExecutionArgs<PartialReposSearchQuery>): Promise<CallToolResult>;
|
|
17
|
-
export {};
|
|
@@ -68,21 +68,26 @@ export declare const GitHubSearchRepositoriesOutputLocalSchema: z.ZodObject<{
|
|
|
68
68
|
currentPage: z.ZodNumber;
|
|
69
69
|
totalPages: z.ZodNumber;
|
|
70
70
|
hasMore: z.ZodBoolean;
|
|
71
|
+
nextPage: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
totalItems: z.ZodOptional<z.ZodNumber>;
|
|
71
74
|
perPage: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
totalFound: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
returned: z.ZodOptional<z.ZodNumber>;
|
|
72
77
|
totalMatches: z.ZodOptional<z.ZodNumber>;
|
|
73
78
|
reportedTotalMatches: z.ZodOptional<z.ZodNumber>;
|
|
74
79
|
reachableTotalMatches: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
totalResults: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
itemsPerPage: z.ZodOptional<z.ZodNumber>;
|
|
75
82
|
totalMatchesKind: z.ZodOptional<z.ZodEnum<{
|
|
76
83
|
exact: "exact";
|
|
77
84
|
reported: "reported";
|
|
78
85
|
lowerBound: "lowerBound";
|
|
79
86
|
}>>;
|
|
80
87
|
totalMatchesCapped: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
-
nextPage: z.ZodOptional<z.ZodNumber>;
|
|
82
88
|
}, z.core.$strip>>;
|
|
83
89
|
}, z.core.$loose>>;
|
|
84
90
|
}, z.core.$loose>>>;
|
|
85
|
-
hints: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
86
91
|
base: z.ZodOptional<z.ZodString>;
|
|
87
92
|
shared: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
88
93
|
responsePagination: z.ZodOptional<z.ZodObject<{
|
|
@@ -70,7 +70,6 @@ export declare const GitHubViewRepoStructureOutputLocalSchema: import("zod").Zod
|
|
|
70
70
|
kind: import("zod").ZodString;
|
|
71
71
|
}, import("zod/v4/core").$loose>]>>>;
|
|
72
72
|
error: import("zod").ZodOptional<import("zod").ZodString>;
|
|
73
|
-
hints: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
74
73
|
base: import("zod").ZodOptional<import("zod").ZodString>;
|
|
75
74
|
shared: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber, import("zod").ZodBoolean]>>>;
|
|
76
75
|
responsePagination: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
@@ -15,6 +15,8 @@ export interface GitHubRepositoryStructureResult {
|
|
|
15
15
|
truncated: boolean;
|
|
16
16
|
filtered: boolean;
|
|
17
17
|
originalCount: number;
|
|
18
|
+
/** True when Git Trees reported truncation — listing may be incomplete. */
|
|
19
|
+
incompleteTree?: boolean;
|
|
18
20
|
};
|
|
19
21
|
structure: Record<string, GitHubRepoStructureDirectoryEntry>;
|
|
20
22
|
fileSizeMap?: Record<string, Record<string, number>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LocalGetFileContentToolResult } from '@octocodeai/octocode-core/extra-types';
|
|
2
|
+
import type { FetchContentQuery } from '../scheme.js';
|
|
3
|
+
export interface ExtractionState {
|
|
4
|
+
resultContent?: string;
|
|
5
|
+
isPartial: boolean;
|
|
6
|
+
actualStartLine?: number;
|
|
7
|
+
actualEndLine?: number;
|
|
8
|
+
matchRanges?: Array<{
|
|
9
|
+
start: number;
|
|
10
|
+
end: number;
|
|
11
|
+
}>;
|
|
12
|
+
warnings?: string[];
|
|
13
|
+
earlyResult?: LocalGetFileContentToolResult;
|
|
14
|
+
}
|
|
15
|
+
export declare function buildExtractionState(query: FetchContentQuery, content: string, _defaultOutputCharLength: number): ExtractionState;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { applyPagination } from '../../../utils/pagination/core.js';
|
|
2
|
+
import type { LocalGetFileContentToolResult } from '@octocodeai/octocode-core/extra-types';
|
|
3
|
+
import type { FetchContentQuery } from '../scheme.js';
|
|
4
|
+
import { type FileStats } from './validation.js';
|
|
5
|
+
import type { ExtractionState } from './extraction.js';
|
|
6
|
+
export type ContentView = 'none' | 'standard' | 'symbols';
|
|
7
|
+
export interface ContentWindow {
|
|
8
|
+
/** The windowed (paginated) slice of the input content. */
|
|
9
|
+
windowedContent: string;
|
|
10
|
+
pagination: ReturnType<typeof applyPagination>;
|
|
11
|
+
/** Requested/auto page size (undefined when no windowing applies). */
|
|
12
|
+
effectiveCharLength: number | undefined;
|
|
13
|
+
/** Explicit charOffset requested by the caller (0 when absent). */
|
|
14
|
+
explicitCharOffset: number;
|
|
15
|
+
autoPaginated: boolean;
|
|
16
|
+
/** Warning emitted when the content was auto-paginated (else undefined). */
|
|
17
|
+
autoPaginateWarning?: string;
|
|
18
|
+
chunkMode: 'semantic' | 'char-limit';
|
|
19
|
+
nextBlockChar?: number;
|
|
20
|
+
/** Ready continuation query for the next char page (undefined when !hasMore). */
|
|
21
|
+
next?: {
|
|
22
|
+
continueChars: {
|
|
23
|
+
tool: 'localGetFileContent';
|
|
24
|
+
query: {
|
|
25
|
+
path: string;
|
|
26
|
+
charOffset: number;
|
|
27
|
+
charLength: number;
|
|
28
|
+
minify: FetchContentQuery['minify'];
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/** Whether pagination fields should be emitted on the result. */
|
|
33
|
+
showPagination: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare function paginateContentWindow(content: string, query: FetchContentQuery, defaultOutputCharLength: number): Promise<ContentWindow>;
|
|
36
|
+
export declare function buildSuccessResult(query: FetchContentQuery, extraction: ExtractionState, fileStats: FileStats, totalLines: number, defaultOutputCharLength: number, shouldMinify?: boolean, contentView?: ContentView): Promise<LocalGetFileContentToolResult>;
|
|
37
|
+
export declare function buildSymbolsSkeletonResult(query: FetchContentQuery, skeleton: string, totalLines: number, sourceChars: number, sourceBytes: number, secretWarning: string | undefined, defaultOutputCharLength: number): Promise<LocalGetFileContentToolResult>;
|
|
38
|
+
export declare function withContentView(result: LocalGetFileContentToolResult, contentView: ContentView): LocalGetFileContentToolResult;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { stat } from 'fs/promises';
|
|
2
|
+
import type { LocalGetFileContentToolResult } from '@octocodeai/octocode-core/extra-types';
|
|
3
|
+
import type { FetchContentQuery } from '../scheme.js';
|
|
4
|
+
export type FileStats = NonNullable<Awaited<ReturnType<typeof stat>>>;
|
|
5
|
+
export declare function sourceSizeFields(sourceChars: number, sourceBytes: number): {
|
|
6
|
+
sourceChars: number;
|
|
7
|
+
sourceBytes: number;
|
|
8
|
+
} | {
|
|
9
|
+
sourceChars: number;
|
|
10
|
+
sourceBytes?: undefined;
|
|
11
|
+
};
|
|
12
|
+
export declare function withSourceSize(result: LocalGetFileContentToolResult, sourceChars: number, sourceBytes: number): LocalGetFileContentToolResult;
|
|
13
|
+
export declare function validateExtractionOptions(query: FetchContentQuery): LocalGetFileContentToolResult | null;
|
|
14
|
+
export declare function getFileStatsOrError(query: FetchContentQuery, absolutePath: string): Promise<{
|
|
15
|
+
fileStats?: FileStats;
|
|
16
|
+
errorResult?: LocalGetFileContentToolResult;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function shouldFailForLargeFile(query: FetchContentQuery, fileSizeKB: number): boolean;
|
|
19
|
+
export declare function createLargeFileErrorResult(query: FetchContentQuery, absolutePath: string, fileSizeKB: number): LocalGetFileContentToolResult;
|
|
20
|
+
export declare function createBinaryFileErrorResult(query: FetchContentQuery, absolutePath: string): LocalGetFileContentToolResult;
|
|
21
|
+
export declare function isLikelyBinaryFile(filePath: string): Promise<boolean>;
|
|
22
|
+
export declare function readFileContentOrError(query: FetchContentQuery, absolutePath: string): Promise<{
|
|
23
|
+
content?: string;
|
|
24
|
+
errorResult?: LocalGetFileContentToolResult;
|
|
25
|
+
}>;
|
|
26
|
+
export declare function createNoMatchesResult(_query: FetchContentQuery, totalLines: number): LocalGetFileContentToolResult;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { LocalGetFileContentToolResult } from '@octocodeai/octocode-core/extra-types';
|
|
2
2
|
import type { FetchContentQuery } from './scheme.js';
|
|
3
|
+
import { type ContentView } from './fetchContent/pagination.js';
|
|
4
|
+
export type { ContentView };
|
|
3
5
|
export declare function fetchContent(query: FetchContentQuery): Promise<LocalGetFileContentToolResult>;
|
|
4
6
|
export declare function finalizeFetchContentResult(result: LocalGetFileContentToolResult, _query: FetchContentQuery, _totalLines: number): LocalGetFileContentToolResult;
|
|
@@ -29,3 +29,93 @@ export declare const LocalFetchContentBulkQuerySchema: z.ZodObject<{
|
|
|
29
29
|
responseCharLength: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
30
30
|
queries: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
31
31
|
}, z.core.$strip>;
|
|
32
|
+
export declare const LocalGetFileContentOutputSchema: z.ZodObject<{
|
|
33
|
+
results: z.ZodArray<z.ZodObject<{
|
|
34
|
+
id: z.ZodString;
|
|
35
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
36
|
+
empty: "empty";
|
|
37
|
+
error: "error";
|
|
38
|
+
}>>;
|
|
39
|
+
data: z.ZodObject<{
|
|
40
|
+
path: z.ZodOptional<z.ZodString>;
|
|
41
|
+
content: z.ZodOptional<z.ZodString>;
|
|
42
|
+
contentView: z.ZodOptional<z.ZodEnum<{
|
|
43
|
+
none: "none";
|
|
44
|
+
standard: "standard";
|
|
45
|
+
symbols: "symbols";
|
|
46
|
+
}>>;
|
|
47
|
+
totalLines: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
sourceChars: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
sourceBytes: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
startLine: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
endLine: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
isPartial: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
+
matchRanges: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
54
|
+
start: z.ZodNumber;
|
|
55
|
+
end: z.ZodNumber;
|
|
56
|
+
}, z.core.$strip>>>;
|
|
57
|
+
pagination: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
58
|
+
charOffset: z.ZodNumber;
|
|
59
|
+
charLength: z.ZodNumber;
|
|
60
|
+
totalChars: z.ZodNumber;
|
|
61
|
+
hasMore: z.ZodBoolean;
|
|
62
|
+
nextCharOffset: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
currentPage: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
totalPages: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
chunkMode: z.ZodOptional<z.ZodEnum<{
|
|
66
|
+
semantic: "semantic";
|
|
67
|
+
"char-limit": "char-limit";
|
|
68
|
+
}>>;
|
|
69
|
+
nextBlockChar: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
+
currentPage: z.ZodNumber;
|
|
72
|
+
totalPages: z.ZodNumber;
|
|
73
|
+
hasMore: z.ZodBoolean;
|
|
74
|
+
nextPage: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
totalItems: z.ZodOptional<z.ZodNumber>;
|
|
77
|
+
perPage: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
totalFound: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
returned: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
totalMatches: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
reportedTotalMatches: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
reachableTotalMatches: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
totalMatchesKind: z.ZodOptional<z.ZodEnum<{
|
|
84
|
+
exact: "exact";
|
|
85
|
+
reported: "reported";
|
|
86
|
+
lowerBound: "lowerBound";
|
|
87
|
+
}>>;
|
|
88
|
+
totalMatchesCapped: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
+
totalResults: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
itemsPerPage: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
}, z.core.$strip>]>>;
|
|
92
|
+
next: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
93
|
+
tool: z.ZodString;
|
|
94
|
+
query: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
95
|
+
why: z.ZodOptional<z.ZodString>;
|
|
96
|
+
confidence: z.ZodOptional<z.ZodEnum<{
|
|
97
|
+
exact: "exact";
|
|
98
|
+
heuristic: "heuristic";
|
|
99
|
+
}>>;
|
|
100
|
+
}, z.core.$strip>>>;
|
|
101
|
+
modified: z.ZodOptional<z.ZodString>;
|
|
102
|
+
lastModified: z.ZodOptional<z.ZodString>;
|
|
103
|
+
lastModifiedBy: z.ZodOptional<z.ZodString>;
|
|
104
|
+
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
105
|
+
matchNotFound: z.ZodOptional<z.ZodBoolean>;
|
|
106
|
+
searchedFor: z.ZodOptional<z.ZodString>;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
base: z.ZodOptional<z.ZodString>;
|
|
110
|
+
shared: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
111
|
+
responsePagination: z.ZodOptional<z.ZodObject<{
|
|
112
|
+
currentPage: z.ZodNumber;
|
|
113
|
+
totalPages: z.ZodNumber;
|
|
114
|
+
hasMore: z.ZodBoolean;
|
|
115
|
+
charOffset: z.ZodNumber;
|
|
116
|
+
charLength: z.ZodNumber;
|
|
117
|
+
totalChars: z.ZodNumber;
|
|
118
|
+
nextCharOffset: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
export type LocalGetFileContentOutput = z.infer<typeof LocalGetFileContentOutputSchema>;
|
|
@@ -7,3 +7,84 @@ export declare const LocalFindFilesBulkQuerySchema: z.ZodObject<{
|
|
|
7
7
|
responseCharLength: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
8
8
|
queries: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
9
9
|
}, z.core.$strip>;
|
|
10
|
+
export declare const LocalFindFilesOutputSchema: z.ZodObject<{
|
|
11
|
+
results: z.ZodArray<z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
14
|
+
empty: "empty";
|
|
15
|
+
error: "error";
|
|
16
|
+
}>>;
|
|
17
|
+
data: z.ZodObject<{
|
|
18
|
+
path: z.ZodOptional<z.ZodString>;
|
|
19
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
20
|
+
name: z.ZodOptional<z.ZodString>;
|
|
21
|
+
path: z.ZodOptional<z.ZodString>;
|
|
22
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
23
|
+
file: "file";
|
|
24
|
+
link: "link";
|
|
25
|
+
directory: "directory";
|
|
26
|
+
dir: "dir";
|
|
27
|
+
symlink: "symlink";
|
|
28
|
+
}>>;
|
|
29
|
+
size: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
30
|
+
sizeFormatted: z.ZodOptional<z.ZodString>;
|
|
31
|
+
modified: z.ZodOptional<z.ZodString>;
|
|
32
|
+
accessed: z.ZodOptional<z.ZodString>;
|
|
33
|
+
created: z.ZodOptional<z.ZodString>;
|
|
34
|
+
permissions: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>>>;
|
|
36
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
37
|
+
pagination: z.ZodOptional<z.ZodObject<{
|
|
38
|
+
currentPage: z.ZodNumber;
|
|
39
|
+
totalPages: z.ZodNumber;
|
|
40
|
+
hasMore: z.ZodBoolean;
|
|
41
|
+
nextPage: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
totalItems: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
perPage: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
totalFound: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
returned: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
reportedTotalMatches: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
reachableTotalMatches: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
totalMatchesKind: z.ZodOptional<z.ZodEnum<{
|
|
50
|
+
exact: "exact";
|
|
51
|
+
reported: "reported";
|
|
52
|
+
lowerBound: "lowerBound";
|
|
53
|
+
}>>;
|
|
54
|
+
totalMatchesCapped: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
totalResults: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
itemsPerPage: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
filesPerPage: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
entriesPerPage: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
matchesPerPage: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
totalFiles: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
totalEntries: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
totalMatches: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
totalFilesFound: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
nextMatchPage: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
next: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
67
|
+
tool: z.ZodString;
|
|
68
|
+
query: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
69
|
+
why: z.ZodOptional<z.ZodString>;
|
|
70
|
+
confidence: z.ZodOptional<z.ZodEnum<{
|
|
71
|
+
exact: "exact";
|
|
72
|
+
heuristic: "heuristic";
|
|
73
|
+
}>>;
|
|
74
|
+
}, z.core.$strip>>>;
|
|
75
|
+
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
}, z.core.$strip>>;
|
|
78
|
+
base: z.ZodOptional<z.ZodString>;
|
|
79
|
+
shared: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
80
|
+
responsePagination: z.ZodOptional<z.ZodObject<{
|
|
81
|
+
currentPage: z.ZodNumber;
|
|
82
|
+
totalPages: z.ZodNumber;
|
|
83
|
+
hasMore: z.ZodBoolean;
|
|
84
|
+
charOffset: z.ZodNumber;
|
|
85
|
+
charLength: z.ZodNumber;
|
|
86
|
+
totalChars: z.ZodNumber;
|
|
87
|
+
nextCharOffset: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
}, z.core.$strip>>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
export type LocalFindFilesOutput = z.infer<typeof LocalFindFilesOutputSchema>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ranking profile data/config — language profile tables, path-role
|
|
3
|
+
* classification, and the tunable weight policy. See
|
|
4
|
+
* `.octocode/RANKING-ARCHITECTURE.md` and the module doc in
|
|
5
|
+
* `../rankingProfile.ts` (the public barrel) for the full contract.
|
|
6
|
+
*
|
|
7
|
+
* This module owns *what* a profile is and *where* a path lives (its role);
|
|
8
|
+
* `rankingScoring.ts` owns *how much* each signal is worth in a score.
|
|
9
|
+
*/
|
|
10
|
+
export type RankingProfileId = 'typescript' | 'javascript' | 'rust' | 'python' | 'go' | 'java' | 'scala' | 'markdown' | 'json' | 'yaml' | 'generic';
|
|
11
|
+
/** TS-level result orderings. `relevance` is the language-aware scorer. */
|
|
12
|
+
export type RankSort = 'relevance' | 'matchCount' | 'path' | 'created' | 'modified' | 'accessed';
|
|
13
|
+
export declare const RANKING_PROFILE_IDS: readonly ["typescript", "javascript", "rust", "python", "go", "java", "scala", "markdown", "json", "yaml", "generic"];
|
|
14
|
+
export type PathRole = 'source' | 'test' | 'docs' | 'config' | 'generated' | 'fixture' | 'unknown';
|
|
15
|
+
/**
|
|
16
|
+
* All ranking weights in one place. Tuning happens here and in the golden
|
|
17
|
+
* fixtures, never scattered across the scorer. Values are deliberately
|
|
18
|
+
* integer-ish and additive so a score can be read back from its reasons.
|
|
19
|
+
*/
|
|
20
|
+
export declare const RANK_WEIGHTS: {
|
|
21
|
+
readonly exactWholeWord: 6;
|
|
22
|
+
readonly exactCaseInsensitive: 3;
|
|
23
|
+
readonly substring: 1;
|
|
24
|
+
readonly declarationLine: 8;
|
|
25
|
+
readonly exportLine: 4;
|
|
26
|
+
readonly importLine: 3;
|
|
27
|
+
readonly configKeyLine: 4;
|
|
28
|
+
readonly headingLine: 4;
|
|
29
|
+
readonly commentOrStringPenalty: -2;
|
|
30
|
+
readonly pathUnderQuery: 4;
|
|
31
|
+
readonly pathSegmentToken: 3;
|
|
32
|
+
readonly extMatchesLangType: 2;
|
|
33
|
+
readonly sourceDir: 1.5;
|
|
34
|
+
readonly lowSignalPathPenalty: -5;
|
|
35
|
+
readonly rareQueryTokenScale: 2;
|
|
36
|
+
readonly rareQueryTokenCap: 3;
|
|
37
|
+
readonly matchCountScale: 1.5;
|
|
38
|
+
readonly matchCountCap: 6;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Bound on how many files get full scoring before pagination. The engine text
|
|
42
|
+
* path returns the entire result set unbounded (no global file/match cap), so
|
|
43
|
+
* for broad terms in a large monorepo we must not score O(total files). When
|
|
44
|
+
* the cap bites we deterministically prefilter (matchCount desc, path asc)
|
|
45
|
+
* before scoring, and the builder surfaces a `truncated`-style note.
|
|
46
|
+
*/
|
|
47
|
+
export declare const RANK_CANDIDATE_CAP = 2000;
|
|
48
|
+
export interface RankingProfile {
|
|
49
|
+
id: RankingProfileId;
|
|
50
|
+
extensions: readonly string[];
|
|
51
|
+
/** Lines that declare/define a symbol named like the query — highest signal. */
|
|
52
|
+
declaration: readonly RegExp[];
|
|
53
|
+
/** Exported/public surface. */
|
|
54
|
+
export: readonly RegExp[];
|
|
55
|
+
/** Import/use lines. */
|
|
56
|
+
import: readonly RegExp[];
|
|
57
|
+
}
|
|
58
|
+
export declare const COMMENT_LINE: RegExp;
|
|
59
|
+
export declare const HEADING_LINE: RegExp;
|
|
60
|
+
export declare const LOW_SIGNAL_PATH: RegExp;
|
|
61
|
+
export declare const EXT_RE: RegExp;
|
|
62
|
+
export declare function fileExtension(path: string): string;
|
|
63
|
+
/** Deterministic profile selection from query langType then file extension. */
|
|
64
|
+
export declare function selectProfile(path: string, langType?: string, override?: RankingProfileId | 'auto'): RankingProfile;
|
|
65
|
+
export declare function classifyPathRole(path: string): PathRole;
|
|
66
|
+
/** True when the query path explicitly targets a low-signal area, so the
|
|
67
|
+
* scorer should not penalize generated/test/docs/fixture roles. Uses anchored
|
|
68
|
+
* path-segment matching (not substring) so `latest/`, `contest/`, `manifest/`
|
|
69
|
+
* do NOT count as low-signal. */
|
|
70
|
+
export declare function isLowSignalQueryPath(path: string | undefined): boolean;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ranking results — the top-level `rankFiles` entry point plus the small
|
|
3
|
+
* lexical helpers (comment/string detection, token indexing) that classify a
|
|
4
|
+
* matched line before the scorer in `rankingScoring.ts` weighs it.
|
|
5
|
+
*
|
|
6
|
+
* `rankFiles` composes the scoring engine (`scoreFileWithRarity`,
|
|
7
|
+
* `buildCandidateTermRarity`) over the whole candidate set: it applies the
|
|
8
|
+
* candidate cap, builds candidate-local term rarity once, scores every file,
|
|
9
|
+
* and produces a total, deterministic order. See the module doc in
|
|
10
|
+
* `../rankingProfile.ts` for the full contract.
|
|
11
|
+
*/
|
|
12
|
+
import type { LocalSearchCodeFile } from '@octocodeai/octocode-core/types';
|
|
13
|
+
import type { RankingProfileId, RankSort } from './rankingProfiles.js';
|
|
14
|
+
import type { FileScore, RankContext } from './rankingScoring.js';
|
|
15
|
+
export interface RankResult {
|
|
16
|
+
files: LocalSearchCodeFile[];
|
|
17
|
+
/** Per-path debug info, only populated when debug is requested. */
|
|
18
|
+
debug?: Map<string, FileScore>;
|
|
19
|
+
/** Number of files dropped by the candidate cap before scoring (0 if none). */
|
|
20
|
+
cappedCandidates: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Rank files by the requested sort mode. `relevance` is the language-aware
|
|
24
|
+
* scorer (default); `matchCount` and `path` are deterministic escape hatches;
|
|
25
|
+
* filesystem sorts (created/modified/accessed) preserve the engine's order.
|
|
26
|
+
*/
|
|
27
|
+
export declare function rankFiles(files: LocalSearchCodeFile[], sort: RankSort, ctx: RankContext, opts?: {
|
|
28
|
+
debug?: boolean;
|
|
29
|
+
candidateCap?: number;
|
|
30
|
+
}): RankResult;
|
|
31
|
+
export declare function matchesAny(patterns: readonly RegExp[], line: string): boolean;
|
|
32
|
+
export declare function escapeRegex(s: string): string;
|
|
33
|
+
/** A search whose keyword is a single bare identifier — the only case where
|
|
34
|
+
* whole-word/substring line-exactness is meaningful (regex/multi-term patterns
|
|
35
|
+
* make the extracted token an arbitrary fragment). */
|
|
36
|
+
export declare function isPlainIdentifierKeyword(keyword?: string): boolean;
|
|
37
|
+
/** Pick the line within a (possibly multi-line context) snippet that actually
|
|
38
|
+
* contains the query token; fall back to the first non-empty line. */
|
|
39
|
+
export declare function matchedLineOf(snippet: string, token: string | undefined, caseSensitive?: boolean): string;
|
|
40
|
+
type LexicalCategory = 'comment' | 'string' | 'code';
|
|
41
|
+
/** Best-effort lexical category of the token's occurrence on a single line.
|
|
42
|
+
* Deterministic and conservative — used only in the regex fallback path when
|
|
43
|
+
* the engine's grammar-accurate AST kind is unavailable. */
|
|
44
|
+
export declare function lexicalCategoryOf(line: string, token: string | undefined, profileId: RankingProfileId, caseSensitive?: boolean): LexicalCategory;
|
|
45
|
+
/** Whether byte index `idx` falls inside a quoted region of the line. */
|
|
46
|
+
export declare function isIndexInsideString(line: string, idx: number): boolean;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ranking scoring engine — turns a candidate file's matches, path, and the
|
|
3
|
+
* query context into an additive, explainable `FileScore`. Every function
|
|
4
|
+
* here appends to a shared `reasons: string[]` accumulator; call order is
|
|
5
|
+
* significant because scores are additive and reasons are appended in the
|
|
6
|
+
* order they are computed. Do not reorder the calls inside
|
|
7
|
+
* `scoreFileWithRarity` or `bestLineScore`.
|
|
8
|
+
*
|
|
9
|
+
* See the module doc in `../rankingProfile.ts` for the full contract.
|
|
10
|
+
*/
|
|
11
|
+
import type { LocalSearchCodeFile } from '@octocodeai/octocode-core/types';
|
|
12
|
+
import { type PathRole, type RankingProfileId } from './rankingProfiles.js';
|
|
13
|
+
export interface RankContext {
|
|
14
|
+
/** Validated, sanitized search base path (query.path). */
|
|
15
|
+
queryPath?: string;
|
|
16
|
+
/** The literal keyword/pattern, used for whole-word / token / path checks. */
|
|
17
|
+
keyword?: string;
|
|
18
|
+
langType?: string;
|
|
19
|
+
caseSensitive?: boolean;
|
|
20
|
+
wholeWord?: boolean;
|
|
21
|
+
/** Profile override from query.rankingProfile. */
|
|
22
|
+
profileOverride?: RankingProfileId | 'auto';
|
|
23
|
+
/** True when the user explicitly searched into a low-signal/test/docs area. */
|
|
24
|
+
explicitLowSignal?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface FileScore {
|
|
27
|
+
score: number;
|
|
28
|
+
profile: RankingProfileId;
|
|
29
|
+
pathRole: PathRole;
|
|
30
|
+
reasons: string[];
|
|
31
|
+
}
|
|
32
|
+
type CandidateTermRarity = {
|
|
33
|
+
candidateCount: number;
|
|
34
|
+
fileTokens: ReadonlyMap<string, readonly string[]>;
|
|
35
|
+
documentFrequency: ReadonlyMap<string, number>;
|
|
36
|
+
};
|
|
37
|
+
export declare function buildCandidateTermRarity(files: LocalSearchCodeFile[], ctx: RankContext): CandidateTermRarity | undefined;
|
|
38
|
+
export declare function scoreFileWithRarity(file: LocalSearchCodeFile, ctx: RankContext, rarity?: CandidateTermRarity): FileScore;
|
|
39
|
+
/** Score one file. Pure and deterministic. */
|
|
40
|
+
export declare function scoreFile(file: LocalSearchCodeFile, ctx: RankContext): FileScore;
|
|
41
|
+
export {};
|