@octocodeai/octocode-tools-core 16.3.0 → 16.6.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 +564 -0
- package/dist/config.d.ts +7 -0
- package/dist/direct.js +39 -41
- package/dist/errors/pathUtils.d.ts +1 -1
- package/dist/github/directoryFetch.d.ts +2 -1
- package/dist/github/githubAPI.d.ts +32 -1
- package/dist/github/history.d.ts +3 -0
- package/dist/github/prTransformation.d.ts +1 -1
- package/dist/github/repoStructureRecursive.d.ts +6 -0
- package/dist/index.d.ts +16 -30
- package/dist/index.js +44 -46
- package/dist/oql/adapters/compile.d.ts +25 -0
- package/dist/oql/adapters/github.d.ts +3 -0
- package/dist/oql/adapters/local.d.ts +7 -0
- package/dist/oql/adapters/materialize.d.ts +11 -0
- package/dist/oql/adapters/pagination.d.ts +21 -0
- package/dist/oql/adapters/researchTargets.d.ts +50 -0
- package/dist/oql/adapters/resultMap.d.ts +20 -0
- package/dist/oql/adapters/ruleYaml.d.ts +11 -0
- package/dist/oql/adapters/runner.d.ts +14 -0
- package/dist/oql/adapters/v2.d.ts +32 -0
- package/dist/oql/capabilities.d.ts +31 -0
- package/dist/oql/defaults.d.ts +26 -0
- package/dist/oql/diagnostics.d.ts +25 -0
- package/dist/oql/diffLanes.d.ts +29 -0
- package/dist/oql/envelope.d.ts +19 -0
- package/dist/oql/features.d.ts +7 -0
- package/dist/oql/index.d.ts +26 -0
- package/dist/oql/index.js +49 -0
- package/dist/oql/normalize.d.ts +5 -0
- package/dist/oql/planner.d.ts +7 -0
- package/dist/oql/research/analyze.d.ts +134 -0
- package/dist/oql/research/packets.d.ts +80 -0
- package/dist/oql/run.d.ts +32 -0
- package/dist/oql/schema.d.ts +1018 -0
- package/dist/oql/schemeText.d.ts +138 -0
- package/dist/oql/shorthand.d.ts +177 -0
- package/dist/oql/targetParams.d.ts +20 -0
- package/dist/oql/transformers/contract.d.ts +19 -0
- package/dist/oql/transformers/github/code.d.ts +17 -0
- package/dist/oql/transformers/github/common.d.ts +8 -0
- package/dist/oql/transformers/language.d.ts +1 -0
- package/dist/oql/transformers/registry.d.ts +16 -0
- package/dist/oql/transformers/types.d.ts +11 -0
- package/dist/oql/types.d.ts +633 -0
- package/dist/oql/v2params.d.ts +22 -0
- package/dist/providers/providerQueries.d.ts +9 -0
- package/dist/providers/providerResults.d.ts +2 -0
- package/dist/providers/types.d.ts +1 -1
- package/dist/schema.d.ts +13 -0
- package/dist/schema.js +8 -0
- package/dist/scheme/coreSchemas.d.ts +5 -5
- package/dist/scheme/fields.d.ts +6 -6
- package/dist/serverConfig.d.ts +1 -2
- package/dist/session.d.ts +2 -24
- package/dist/shared/config/defaults.d.ts +14 -0
- package/dist/shared/config/index.d.ts +9 -0
- package/dist/shared/config/index.js +9 -0
- package/dist/shared/config/loader.d.ts +7 -0
- package/dist/shared/config/resolver.d.ts +2 -0
- package/dist/shared/config/resolverCache.d.ts +12 -0
- package/dist/shared/config/resolverSections.d.ts +10 -0
- package/dist/shared/config/runtimeSurface.d.ts +21 -0
- package/dist/shared/config/schemas.d.ts +11 -0
- package/dist/shared/config/types.d.ts +92 -0
- package/dist/shared/config/validator.d.ts +2 -0
- package/dist/shared/credentials/constants.d.ts +2 -0
- package/dist/shared/credentials/credentialCache.d.ts +13 -0
- package/dist/shared/credentials/credentialEncryption.d.ts +10 -0
- package/dist/shared/credentials/credentialUtils.d.ts +4 -0
- package/dist/shared/credentials/envTokens.d.ts +9 -0
- package/dist/shared/credentials/ghCli.d.ts +1 -0
- package/dist/shared/credentials/index.d.ts +3 -0
- package/dist/shared/credentials/index.js +8 -0
- package/dist/shared/credentials/schemas.d.ts +22 -0
- package/dist/shared/credentials/storage.d.ts +30 -0
- package/dist/shared/credentials/testing.d.ts +2 -0
- package/dist/shared/credentials/testing.js +8 -0
- package/dist/shared/credentials/tokenRefresh.d.ts +24 -0
- package/dist/shared/credentials/tokenResolution.d.ts +30 -0
- package/dist/shared/credentials/types.d.ts +28 -0
- package/dist/shared/fs-utils.d.ts +2 -0
- package/dist/shared/fs-utils.js +8 -0
- package/dist/shared/index.d.ts +6 -0
- package/dist/shared/languageSelectors.d.ts +23 -0
- package/dist/shared/paths.d.ts +31 -0
- package/dist/shared/paths.js +8 -0
- package/dist/shared/platform/index.d.ts +1 -0
- package/dist/shared/platform/index.js +8 -0
- package/dist/shared/platform/platform.d.ts +8 -0
- package/dist/shared/session/index.d.ts +5 -0
- package/dist/shared/session/index.js +8 -0
- package/dist/shared/session/schemas.d.ts +103 -0
- package/dist/shared/session/sessionCache.d.ts +9 -0
- package/dist/shared/session/sessionDiskIO.d.ts +6 -0
- package/dist/shared/session/statsDefaults.d.ts +4 -0
- package/dist/shared/session/storage.d.ts +20 -0
- package/dist/shared/session/types.d.ts +53 -0
- package/dist/tools/directToolCatalog.d.ts +15 -56
- package/dist/tools/directToolCatalog.exec.d.ts +11 -0
- package/dist/tools/directToolCatalog.meta.d.ts +82 -0
- package/dist/tools/github_clone_repo/cache.d.ts +5 -1
- package/dist/tools/github_clone_repo/scheme.d.ts +56 -9
- package/dist/tools/github_clone_repo/types.d.ts +3 -1
- package/dist/tools/github_fetch_content/scheme.d.ts +112 -4
- package/dist/tools/github_fetch_content/types.d.ts +39 -0
- package/dist/tools/github_search_code/scheme.d.ts +6 -6
- package/dist/tools/github_search_pull_requests/contentResponse.d.ts +0 -1
- package/dist/tools/github_search_pull_requests/execution.d.ts +1 -11
- package/dist/tools/github_search_pull_requests/scheme.d.ts +6 -2
- package/dist/tools/github_search_repos/scheme.d.ts +7 -6
- package/dist/tools/github_view_repo_structure/execution.d.ts +0 -9
- package/dist/tools/github_view_repo_structure/scheme.d.ts +10 -6
- package/dist/tools/local_binary_inspect/archiveOps.d.ts +2 -0
- package/dist/tools/local_binary_inspect/binaryInspector.d.ts +48 -7
- package/dist/tools/local_binary_inspect/binaryOps.d.ts +16 -7
- package/dist/tools/local_binary_inspect/scheme.d.ts +10 -7
- package/dist/tools/local_fetch_content/scheme.d.ts +2 -2
- package/dist/tools/local_find_files/scheme.d.ts +2 -2
- package/dist/tools/local_ripgrep/lspBoost.d.ts +54 -0
- package/dist/tools/local_ripgrep/rankingProfile.d.ts +113 -0
- package/dist/tools/local_ripgrep/ripgrepResultBuilder.d.ts +10 -1
- package/dist/tools/local_ripgrep/scheme.d.ts +29 -4
- package/dist/tools/local_ripgrep/structuralSearch.d.ts +3 -4
- package/dist/tools/local_view_structure/scheme.d.ts +2 -2
- package/dist/tools/local_view_structure/structureFilters.d.ts +1 -3
- package/dist/tools/local_view_structure/structureResponse.d.ts +1 -0
- package/dist/tools/lsp/semantic_content/scheme.d.ts +174 -10
- package/dist/tools/lsp/shared/callHierarchyTraversal.d.ts +2 -2
- package/dist/tools/lsp/shared/resolveSymbolAnchor.d.ts +2 -2
- package/dist/tools/lsp/shared/semanticTypes.d.ts +36 -6
- package/dist/tools/oql_search/execution.d.ts +7 -0
- package/dist/tools/package_search/execution.d.ts +10 -0
- package/dist/tools/package_search/scheme.d.ts +9 -7
- package/dist/tools/providerMappers.d.ts +24 -5
- package/dist/tools/toolConfig.d.ts +1 -0
- package/dist/tools/toolMetadata/proxies.d.ts +0 -6
- package/dist/tools/toolNames.d.ts +2 -0
- package/dist/tools/utils.d.ts +3 -7
- package/dist/types/bulk.d.ts +0 -2
- package/dist/types/execution.d.ts +1 -2
- package/dist/types/server.d.ts +0 -1
- package/dist/types/session.d.ts +0 -19
- package/dist/types/toolResults.d.ts +2 -3
- package/dist/utils/contextUtils.d.ts +49 -2
- package/dist/utils/core/lines.d.ts +16 -0
- package/dist/utils/core/types.d.ts +12 -1
- package/dist/utils/file/filters.d.ts +2 -11
- package/dist/utils/markdownOutline.d.ts +10 -0
- package/dist/utils/parsers/diff.d.ts +18 -0
- package/dist/utils/response/error.d.ts +38 -4
- package/dist/utils/response/groupedFinalizer.d.ts +0 -25
- package/package.json +51 -14
- package/dist/commands/BaseCommandBuilder.d.ts +0 -14
- package/dist/commands/FindCommandBuilder.d.ts +0 -23
- package/dist/commands/LsCommandBuilder.d.ts +0 -15
- package/dist/commands/RipgrepCommandBuilder.d.ts +0 -27
- package/dist/hints/dynamic.d.ts +0 -6
- package/dist/hints/index.d.ts +0 -2
- package/dist/hints/types.d.ts +0 -1
- package/dist/tools/github_clone_repo/hints.d.ts +0 -2
- package/dist/tools/github_fetch_content/hints.d.ts +0 -2
- package/dist/tools/github_search_code/hints.d.ts +0 -2
- package/dist/tools/github_search_pull_requests/hints.d.ts +0 -2
- package/dist/tools/github_search_repos/hints.d.ts +0 -2
- package/dist/tools/github_view_repo_structure/hints.d.ts +0 -2
- package/dist/tools/local_fetch_content/hints.d.ts +0 -2
- package/dist/tools/local_find_files/hints.d.ts +0 -2
- package/dist/tools/local_ripgrep/grepFallbackExecutor.d.ts +0 -3
- package/dist/tools/local_ripgrep/hints.d.ts +0 -2
- package/dist/tools/local_ripgrep/ripgrepParser.d.ts +0 -9
- package/dist/tools/local_view_structure/hints.d.ts +0 -2
- package/dist/tools/local_view_structure/structureParser.d.ts +0 -3
- package/dist/tools/local_view_structure/structureWalker.d.ts +0 -24
- package/dist/tools/lsp/semantic_content/hints.d.ts +0 -4
- package/dist/tools/package_search/hints.d.ts +0 -2
- package/dist/types/metadata.d.ts +0 -69
- package/dist/utils/exec/commandAvailability.d.ts +0 -19
- package/dist/utils/exec/ripgrepBinary.d.ts +0 -3
- package/dist/utils/pagination/outputSizeLimit.d.ts +0 -16
- package/dist/utils/response/structuredPagination.d.ts +0 -9
package/dist/types/session.d.ts
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
export interface SessionData {
|
|
2
|
-
sessionId: string;
|
|
3
|
-
intent: 'init' | 'error' | 'tool_call' | 'rate_limit';
|
|
4
|
-
data: ToolCallData | ErrorData | RateLimitData | Record<string, never>;
|
|
5
|
-
timestamp: string;
|
|
6
|
-
version: string;
|
|
7
|
-
}
|
|
8
|
-
export interface ToolCallData {
|
|
9
|
-
tool_name: string;
|
|
10
|
-
repos: string[];
|
|
11
|
-
provider?: string;
|
|
12
|
-
mainResearchGoal?: string;
|
|
13
|
-
researchGoal?: string;
|
|
14
|
-
reasoning?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface ErrorData {
|
|
17
|
-
error: string;
|
|
18
|
-
provider?: string;
|
|
19
|
-
}
|
|
20
1
|
export interface RateLimitData {
|
|
21
2
|
limit_type: 'primary' | 'secondary' | 'graphql' | 'precheck_blocked';
|
|
22
3
|
retry_after_seconds?: number;
|
|
@@ -2,7 +2,6 @@ import type { GitHubAPIError } from '../github/githubAPI.js';
|
|
|
2
2
|
export type QueryStatus = 'empty' | 'error';
|
|
3
3
|
interface ToolResult {
|
|
4
4
|
status?: QueryStatus;
|
|
5
|
-
hints?: string[];
|
|
6
5
|
[key: string]: unknown;
|
|
7
6
|
}
|
|
8
7
|
export interface ToolErrorResult extends ToolResult {
|
|
@@ -16,6 +15,8 @@ export interface PaginationInfo {
|
|
|
16
15
|
currentPage: number;
|
|
17
16
|
totalPages: number;
|
|
18
17
|
hasMore: boolean;
|
|
18
|
+
nextPage?: number;
|
|
19
|
+
nextMatchPage?: number;
|
|
19
20
|
charOffset?: number;
|
|
20
21
|
charLength?: number;
|
|
21
22
|
totalChars?: number;
|
|
@@ -41,7 +42,6 @@ export interface ProcessedBulkResult {
|
|
|
41
42
|
data?: Record<string, unknown>;
|
|
42
43
|
error?: string | GitHubAPIError;
|
|
43
44
|
status?: QueryStatus;
|
|
44
|
-
hints?: readonly string[] | string[];
|
|
45
45
|
[key: string]: unknown;
|
|
46
46
|
}
|
|
47
47
|
export interface FlatQueryResult {
|
|
@@ -55,7 +55,6 @@ export interface QueryError {
|
|
|
55
55
|
}
|
|
56
56
|
export interface StructuredToolResponse {
|
|
57
57
|
data?: unknown;
|
|
58
|
-
hints?: string[];
|
|
59
58
|
instructions?: string;
|
|
60
59
|
[key: string]: unknown;
|
|
61
60
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type * as NativeContextUtils from '@octocodeai/octocode-
|
|
2
|
-
export type { ExtractMatchingLinesOptions, ExtractMatchingLinesResult, FilterPatchOptions, FileSystemEntry, FileSystemQueryOptions, FileSystemQueryResult, MinifyResult, JsonInput, RipgrepParseOptions, RipgrepParseResult, SliceContentOptions, SliceContentResult, StructuralMatch, YamlConversionConfig, } from '@octocodeai/octocode-
|
|
1
|
+
import type * as NativeContextUtils from '@octocodeai/octocode-engine';
|
|
2
|
+
export type { BinaryInspectInfo, BinaryStrings, ExtractMatchingLinesOptions, ExtractMatchingLinesResult, FilterPatchOptions, FileSystemEntry, FileSystemQueryOptions, FileSystemQueryResult, GraphFactCapability, GraphFactCall, GraphFactDeclaration, GraphFactEdge, GraphFactExport, GraphFactImport, GraphFacts, MinifyResult, JsonInput, RipgrepParseOptions, RipgrepParseResult, RipgrepSearchOptions, SliceContentOptions, SliceContentResult, StructuralMatch, YamlConversionConfig, } from '@octocodeai/octocode-engine';
|
|
3
3
|
type NativeContextUtilsModule = typeof NativeContextUtils;
|
|
4
4
|
type NativeLoader = () => NativeContextUtilsModule;
|
|
5
5
|
export declare class ContextUtilsLoadError extends Error {
|
|
@@ -16,10 +16,57 @@ export declare const contextUtils: {
|
|
|
16
16
|
minifyContentResult(content: string, filePath: string): NativeContextUtils.MinifyResult;
|
|
17
17
|
minifyMarkdownCore(content: string): string;
|
|
18
18
|
extractSignatures(content: string, filePath: string): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Native JS/TS document symbols as a JSON `DocumentSymbol[]` string, or null
|
|
21
|
+
* when oxc declines the input (non-JS/TS, oversized, hard parse failure, or
|
|
22
|
+
* no symbols). Server-free, syntax-only — no type inference.
|
|
23
|
+
*/
|
|
24
|
+
extractJsSymbols(content: string, filePath: string): string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Native in-file references as a JSON `Range[]` (declaration first), or null
|
|
27
|
+
* when oxc declines the input or the cursor is not on a resolvable binding.
|
|
28
|
+
* Same-file only, syntax-only — no type inference, no cross-file resolution.
|
|
29
|
+
*/
|
|
30
|
+
findInFileReferences(content: string, filePath: string, line: number, character: number): string | null;
|
|
31
|
+
/**
|
|
32
|
+
* Native JS/TS graph facts as a JSON `GraphFacts` object. Syntax-level only:
|
|
33
|
+
* declarations/imports/exports, containment, and direct call expressions.
|
|
34
|
+
*/
|
|
35
|
+
extractGraphFacts(content: string, filePath: string): string | null;
|
|
36
|
+
/**
|
|
37
|
+
* Canonical lowercase extensions (no leading dot) the native oxc JS/TS path
|
|
38
|
+
* handles. Source of truth lives in the engine — gate native dispatch on this.
|
|
39
|
+
*/
|
|
40
|
+
getSupportedJsTsExtensions(): string[];
|
|
41
|
+
/**
|
|
42
|
+
* Canonical lowercase extensions (no leading dot) that can emit native
|
|
43
|
+
* GraphFacts. JS/TS use OXC; other entries use tree-sitter syntax inventory.
|
|
44
|
+
*/
|
|
45
|
+
getSupportedGraphFactExtensions(): string[];
|
|
46
|
+
/**
|
|
47
|
+
* Native graph-fact capability matrix as a JSON `GraphFactCapability[]`.
|
|
48
|
+
*/
|
|
49
|
+
getGraphFactCapabilities(): string;
|
|
19
50
|
structuralSearch(content: string, filePath: string, pattern?: string | null, rule?: string | null): NativeContextUtils.StructuralMatch[];
|
|
51
|
+
structuralSearchFiles(options: NativeContextUtils.StructuralSearchFilesOptions): NativeContextUtils.StructuralSearchFilesResult;
|
|
52
|
+
getSupportedStructuralExtensions(): string[];
|
|
53
|
+
/**
|
|
54
|
+
* Native binary inspection (format lane). Parses an executable / object /
|
|
55
|
+
* archive and returns identity + symbols/imports/exports/sections/deps.
|
|
56
|
+
* Degrades to magic-byte identity on malformed input; only unreadable or
|
|
57
|
+
* oversized files throw.
|
|
58
|
+
*/
|
|
59
|
+
inspectBinaryNative(path: string): NativeContextUtils.BinaryInspectInfo;
|
|
60
|
+
/**
|
|
61
|
+
* Native strings extraction — printable ASCII + UTF-16 (LE/BE) runs of at
|
|
62
|
+
* least `minLength`, longest-first, optionally hex offset-prefixed.
|
|
63
|
+
*/
|
|
64
|
+
extractBinaryStringsNative(path: string, minLength: number, includeOffsets: boolean, scanOffset?: number): NativeContextUtils.BinaryStrings;
|
|
65
|
+
validateRipgrepPattern(pattern: string, fixedString?: boolean | null, perlRegex?: boolean | null): NativeContextUtils.RipgrepPatternValidationResult;
|
|
20
66
|
getSemanticBoundaryOffsets(content: string, filePath: string): number[];
|
|
21
67
|
jsonToYamlString(jsonObject: NativeContextUtils.JsonInput, config?: NativeContextUtils.YamlConversionConfig | null): string;
|
|
22
68
|
parseRipgrepJson(stdout: string, options?: NativeContextUtils.RipgrepParseOptions | null): NativeContextUtils.RipgrepParseResult;
|
|
69
|
+
searchRipgrep(options: NativeContextUtils.RipgrepSearchOptions): Promise<NativeContextUtils.RipgrepParseResult>;
|
|
23
70
|
queryFileSystem(options: NativeContextUtils.FileSystemQueryOptions): NativeContextUtils.FileSystemQueryResult;
|
|
24
71
|
extractMatchingLines(content: string, pattern: string, options?: NativeContextUtils.ExtractMatchingLinesOptions | null): NativeContextUtils.ExtractMatchingLinesResult;
|
|
25
72
|
filterPatch(patch: string, options?: NativeContextUtils.FilterPatchOptions | null): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Split `content` into its text lines, handling LF and CRLF endings.
|
|
3
|
+
*
|
|
4
|
+
* A line is a maximal run of characters terminated by a newline or by EOF. A
|
|
5
|
+
* single trailing newline terminates the last line; it does not start a new
|
|
6
|
+
* empty one, so `"a\nb\n"` yields `["a", "b"]`, not `["a", "b", ""]`. A plain
|
|
7
|
+
* `split('\n')` gets this wrong by emitting a trailing empty segment for
|
|
8
|
+
* newline-terminated text. A genuine blank final line (`"a\n\n"`) is preserved
|
|
9
|
+
* — only the single terminator is dropped.
|
|
10
|
+
*/
|
|
11
|
+
export declare function splitLines(content: string): string[];
|
|
12
|
+
/**
|
|
13
|
+
* Number of text lines in `content`. Equals `splitLines(content).length`; see
|
|
14
|
+
* {@link splitLines} for how trailing newlines are handled.
|
|
15
|
+
*/
|
|
16
|
+
export declare function countLines(content: string): number;
|
|
@@ -3,6 +3,8 @@ export interface ExecResult {
|
|
|
3
3
|
stdout: string;
|
|
4
4
|
stderr: string;
|
|
5
5
|
success: boolean;
|
|
6
|
+
/** True when output hit maxOutputSize and stdout is the partial prefix. */
|
|
7
|
+
truncated?: boolean;
|
|
6
8
|
}
|
|
7
9
|
export interface ExecOptions {
|
|
8
10
|
cwd?: string;
|
|
@@ -10,11 +12,19 @@ export interface ExecOptions {
|
|
|
10
12
|
env?: Record<string, string>;
|
|
11
13
|
maxOutputSize?: number;
|
|
12
14
|
toolName?: string;
|
|
15
|
+
/**
|
|
16
|
+
* When true, an output-size overflow returns the partial stdout flagged
|
|
17
|
+
* `truncated` instead of throwing. For commands (e.g. `strings` on a huge
|
|
18
|
+
* binary) where a bounded prefix is still useful.
|
|
19
|
+
*/
|
|
20
|
+
tolerateOutputLimit?: boolean;
|
|
13
21
|
}
|
|
14
22
|
export interface PaginationInfo {
|
|
15
23
|
currentPage: number;
|
|
16
24
|
totalPages: number;
|
|
17
25
|
hasMore: boolean;
|
|
26
|
+
nextPage?: number;
|
|
27
|
+
nextMatchPage?: number;
|
|
18
28
|
charOffset?: number;
|
|
19
29
|
charLength?: number;
|
|
20
30
|
totalChars?: number;
|
|
@@ -34,7 +44,8 @@ export interface PaginationInfo {
|
|
|
34
44
|
totalMatchesCapped?: boolean;
|
|
35
45
|
}
|
|
36
46
|
export interface SearchStats {
|
|
37
|
-
|
|
47
|
+
totalOccurrences?: number;
|
|
48
|
+
totalStructuralMatches?: number;
|
|
38
49
|
matchedLines?: number;
|
|
39
50
|
filesMatched?: number;
|
|
40
51
|
filesSearched?: number;
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export declare const IGNORED_FILE_EXTENSIONS: string[];
|
|
4
|
-
export declare function shouldIgnoreDir(folderName: string): boolean;
|
|
5
|
-
export declare function shouldIgnoreFile(filePath: string): boolean;
|
|
6
|
-
interface GetExtensionOptions {
|
|
7
|
-
lowercase?: boolean;
|
|
8
|
-
fallback?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function getExtension(filePath: string, options?: GetExtensionOptions): string;
|
|
11
|
-
export {};
|
|
1
|
+
export { DISCOVERY_IGNORED_FILE_EXTENSIONS as IGNORED_FILE_EXTENSIONS, DISCOVERY_IGNORED_FILE_NAMES as IGNORED_FILE_NAMES, DISCOVERY_IGNORED_FOLDER_NAMES as IGNORED_FOLDER_NAMES, getDiscoveryExtension as getExtension, shouldIgnoreDiscoveryDir as shouldIgnoreDir, shouldIgnoreDiscoveryFile as shouldIgnoreFile, } from '@octocodeai/octocode-engine/security';
|
|
2
|
+
export type { DiscoveryExtensionOptions as GetExtensionOptions } from '@octocodeai/octocode-engine/security';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type MarkdownHeading = {
|
|
2
|
+
line: number;
|
|
3
|
+
level: number;
|
|
4
|
+
text: string;
|
|
5
|
+
children: MarkdownHeading[];
|
|
6
|
+
};
|
|
7
|
+
export declare function isMarkdownFilePath(filePath: string): boolean;
|
|
8
|
+
export declare function extractMarkdownHeadingOutline(content: string, filePath: string): MarkdownHeading[] | null;
|
|
9
|
+
export declare function markdownHeadingOutlineToText(content: string, filePath: string): string | null;
|
|
10
|
+
export declare function markdownHeadingOutlineToDocumentSymbols(content: string, filePath: string): unknown[] | null;
|
|
@@ -1,2 +1,20 @@
|
|
|
1
|
+
/** Max diff lines carried in a {@link DiffPreview} before the rest are summarized. */
|
|
2
|
+
export declare const DIFF_PREVIEW_MAX_LINES = 20;
|
|
3
|
+
/**
|
|
4
|
+
* A render-ready slice of a patch: the first {@link DIFF_PREVIEW_MAX_LINES}
|
|
5
|
+
* lines plus a count of how many were withheld. Consumers (e.g. the CLI) only
|
|
6
|
+
* colorize `lines` and print `moreCount` — they do no splitting or counting, so
|
|
7
|
+
* the trailing-newline off-by-one lives in exactly one place.
|
|
8
|
+
*/
|
|
9
|
+
export interface DiffPreview {
|
|
10
|
+
lines: string[];
|
|
11
|
+
moreCount: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Build a {@link DiffPreview} from a raw patch string. Splitting is newline-safe
|
|
15
|
+
* via {@link splitLines}, so a patch that ends in a newline neither inflates
|
|
16
|
+
* `moreCount` nor surfaces a phantom blank line.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildDiffPreview(patch: string | undefined, maxLines?: number): DiffPreview;
|
|
1
19
|
export declare function filterPatch(patch: string, additions?: number[], deletions?: number[]): string;
|
|
2
20
|
export declare function trimDiffContext(patch: string): string;
|
|
@@ -5,16 +5,50 @@ export interface UnifiedErrorResult {
|
|
|
5
5
|
status: 'error';
|
|
6
6
|
error?: string | GitHubAPIError;
|
|
7
7
|
errorCode?: string;
|
|
8
|
-
hints?: string[];
|
|
9
8
|
[key: string]: unknown;
|
|
10
9
|
}
|
|
11
10
|
interface CreateErrorResultOptions {
|
|
12
11
|
toolName?: string;
|
|
13
|
-
hintContext?: Record<string, unknown>;
|
|
14
12
|
extra?: Record<string, unknown>;
|
|
15
|
-
customHints?: string[];
|
|
16
|
-
hintSourceError?: GitHubAPIError;
|
|
17
13
|
rawResponse?: unknown;
|
|
18
14
|
}
|
|
19
15
|
export declare function createErrorResult(error: unknown, _query: PartialBaseQuery, options?: CreateErrorResultOptions): UnifiedErrorResult;
|
|
16
|
+
/**
|
|
17
|
+
* Minimal shape of the parts of a Zod schema this helper relies on, kept
|
|
18
|
+
* version-agnostic so it does not couple to a specific Zod release.
|
|
19
|
+
*/
|
|
20
|
+
interface SafeParseableSchema<T> {
|
|
21
|
+
safeParse(input: unknown): {
|
|
22
|
+
success: true;
|
|
23
|
+
data: T;
|
|
24
|
+
error?: never;
|
|
25
|
+
} | {
|
|
26
|
+
success: false;
|
|
27
|
+
data?: never;
|
|
28
|
+
error: {
|
|
29
|
+
issues: Array<{
|
|
30
|
+
message: string;
|
|
31
|
+
}>;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export type SafeParseOutcome<T> = {
|
|
36
|
+
ok: true;
|
|
37
|
+
data: T;
|
|
38
|
+
} | {
|
|
39
|
+
ok: false;
|
|
40
|
+
error: UnifiedErrorResult;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Validate `input` against `schema`, returning either the parsed data or a
|
|
44
|
+
* structured {@link UnifiedErrorResult} built via {@link createErrorResult}.
|
|
45
|
+
*
|
|
46
|
+
* Replaces the per-tool `safeParse → issues.map(...).join('; ') →
|
|
47
|
+
* createErrorResult('Validation error: …')` block. Pass `prefix: false` to
|
|
48
|
+
* omit the "Validation error: " prefix (github_fetch_content parity).
|
|
49
|
+
*/
|
|
50
|
+
export declare function safeParseOrError<T>(schema: SafeParseableSchema<T>, query: PartialBaseQuery, options?: {
|
|
51
|
+
toolName?: string;
|
|
52
|
+
prefix?: boolean;
|
|
53
|
+
}): SafeParseOutcome<T>;
|
|
20
54
|
export {};
|
|
@@ -1,37 +1,12 @@
|
|
|
1
1
|
import type { BulkFinalizerOutput } from '../../types/bulk.js';
|
|
2
2
|
import type { FlatQueryResult } from '../../types/toolResults.js';
|
|
3
|
-
export type CharPagination = {
|
|
4
|
-
currentPage: number;
|
|
5
|
-
totalPages: number;
|
|
6
|
-
hasMore: boolean;
|
|
7
|
-
charOffset: number;
|
|
8
|
-
charLength: number;
|
|
9
|
-
totalChars: number;
|
|
10
|
-
};
|
|
11
3
|
export type QueryWithPagination = {
|
|
12
4
|
id?: unknown;
|
|
13
5
|
charLength?: unknown;
|
|
14
6
|
charOffset?: unknown;
|
|
15
7
|
};
|
|
16
|
-
type CharWindowConfig<TGroup, TItem> = {
|
|
17
|
-
groups: TGroup[];
|
|
18
|
-
getItems: (group: TGroup) => readonly TItem[];
|
|
19
|
-
setItems: (group: TGroup, items: TItem[]) => TGroup;
|
|
20
|
-
getItemText?: (item: TItem) => string | undefined;
|
|
21
|
-
setItemText?: (item: TItem, text: string) => TItem;
|
|
22
|
-
charOffset: number;
|
|
23
|
-
charLength: number;
|
|
24
|
-
maxItems?: number;
|
|
25
|
-
};
|
|
26
|
-
export declare function paginateGroupsCharWindow<TGroup, TItem>({ groups, getItems, setItems, getItemText, setItemText, charOffset, charLength, maxItems, }: CharWindowConfig<TGroup, TItem>): {
|
|
27
|
-
groups: TGroup[];
|
|
28
|
-
pagination: CharPagination;
|
|
29
|
-
};
|
|
30
|
-
export declare function dedupeHints(hints: readonly string[]): string[];
|
|
31
8
|
export declare function collectFlatErrors(results: readonly FlatQueryResult[]): Array<{
|
|
32
9
|
id: string;
|
|
33
10
|
error: string;
|
|
34
|
-
hints?: string[];
|
|
35
11
|
}>;
|
|
36
12
|
export declare function formatFinalizedResponse<T extends Record<string, unknown>>(responseData: T, keysPriority: readonly string[], isError?: boolean): BulkFinalizerOutput<T>;
|
|
37
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octocodeai/octocode-tools-core",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.6.0",
|
|
4
4
|
"description": "Core tool implementations for Octocode: GitHub, local filesystem, LSP, and package search tools.",
|
|
5
5
|
"author": "Guy Bary <bgauryy@octocodeai.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,51 +16,88 @@
|
|
|
16
16
|
"types": "./dist/direct.d.ts",
|
|
17
17
|
"import": "./dist/direct.js"
|
|
18
18
|
},
|
|
19
|
+
"./schema": {
|
|
20
|
+
"types": "./dist/schema.d.ts",
|
|
21
|
+
"import": "./dist/schema.js"
|
|
22
|
+
},
|
|
23
|
+
"./oql": {
|
|
24
|
+
"types": "./dist/oql/index.d.ts",
|
|
25
|
+
"import": "./dist/oql/index.js"
|
|
26
|
+
},
|
|
19
27
|
"./zod": {
|
|
20
28
|
"types": "./dist/zod.d.ts",
|
|
21
29
|
"import": "./dist/zod.js"
|
|
30
|
+
},
|
|
31
|
+
"./credentials": {
|
|
32
|
+
"types": "./dist/shared/credentials/index.d.ts",
|
|
33
|
+
"import": "./dist/shared/credentials/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./platform": {
|
|
36
|
+
"types": "./dist/shared/platform/index.d.ts",
|
|
37
|
+
"import": "./dist/shared/platform/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./session": {
|
|
40
|
+
"types": "./dist/shared/session/index.d.ts",
|
|
41
|
+
"import": "./dist/shared/session/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./config": {
|
|
44
|
+
"types": "./dist/shared/config/index.d.ts",
|
|
45
|
+
"import": "./dist/shared/config/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./paths": {
|
|
48
|
+
"types": "./dist/shared/paths.d.ts",
|
|
49
|
+
"import": "./dist/shared/paths.js"
|
|
50
|
+
},
|
|
51
|
+
"./fs-utils": {
|
|
52
|
+
"types": "./dist/shared/fs-utils.d.ts",
|
|
53
|
+
"import": "./dist/shared/fs-utils.js"
|
|
54
|
+
},
|
|
55
|
+
"./testing": {
|
|
56
|
+
"types": "./dist/shared/credentials/testing.d.ts",
|
|
57
|
+
"import": "./dist/shared/credentials/testing.js"
|
|
22
58
|
}
|
|
23
59
|
},
|
|
24
60
|
"files": [
|
|
25
61
|
"dist",
|
|
26
|
-
"LICENSE"
|
|
62
|
+
"LICENSE",
|
|
63
|
+
"README.md"
|
|
27
64
|
],
|
|
28
65
|
"engines": {
|
|
29
66
|
"node": ">=20.0.0"
|
|
30
67
|
},
|
|
31
68
|
"scripts": {
|
|
32
|
-
"build": "yarn clean && node build.mjs && tsc --emitDeclarationOnly -p tsconfig.build.json",
|
|
33
|
-
"build:dev": "node build.mjs && tsc --emitDeclarationOnly -p tsconfig.build.json",
|
|
69
|
+
"build": "yarn readme:sync && yarn clean && node build.mjs && tsc --emitDeclarationOnly -p tsconfig.build.json",
|
|
70
|
+
"build:dev": "yarn readme:sync && node build.mjs && tsc --emitDeclarationOnly -p tsconfig.build.json",
|
|
34
71
|
"clean": "rm -rf dist/",
|
|
35
72
|
"lint": "eslint src",
|
|
36
73
|
"lint:fix": "eslint src --fix",
|
|
37
74
|
"test": "vitest run --coverage",
|
|
38
75
|
"test:quiet": "vitest run --reporter=dot --silent",
|
|
39
76
|
"typecheck": "tsc --noEmit --skipLibCheck -p tsconfig.json",
|
|
40
|
-
"verify": "yarn lint && yarn typecheck && yarn test"
|
|
77
|
+
"verify": "yarn lint && yarn typecheck && yarn test",
|
|
78
|
+
"readme:sync": "node ../../scripts/sync-package-readmes.mjs .",
|
|
79
|
+
"prepack": "yarn readme:sync"
|
|
41
80
|
},
|
|
42
81
|
"dependencies": {
|
|
43
82
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
44
|
-
"@octocodeai/octocode-
|
|
45
|
-
"@octocodeai/octocode-
|
|
83
|
+
"@octocodeai/octocode-core": "^16.5.3",
|
|
84
|
+
"@octocodeai/octocode-engine": "^16.6.0",
|
|
85
|
+
"@octokit/oauth-methods": "^6.0.2",
|
|
46
86
|
"@octokit/plugin-throttling": "^11.0.3",
|
|
47
|
-
"@
|
|
87
|
+
"@octokit/request": "^10.0.10",
|
|
48
88
|
"node-cache": "^5.1.2",
|
|
49
|
-
"octocode-lsp": "^16.3.0",
|
|
50
|
-
"octocode-security": "^16.3.0",
|
|
51
|
-
"octocode-shared": "workspace:^",
|
|
52
89
|
"octokit": "^5.0.5",
|
|
53
|
-
"zod": "^4.3
|
|
90
|
+
"zod": "^4.4.3"
|
|
54
91
|
},
|
|
55
92
|
"devDependencies": {
|
|
56
93
|
"@octokit/core": "^7.0.6",
|
|
57
94
|
"@octokit/openapi-types": "^27.0.0",
|
|
58
95
|
"@octokit/plugin-rest-endpoint-methods": "^17.0.0",
|
|
59
96
|
"@types/node": "^25.9.3",
|
|
60
|
-
"@vitest/coverage-v8": "^4.
|
|
97
|
+
"@vitest/coverage-v8": "^4.1.9",
|
|
61
98
|
"esbuild": "^0.28.1",
|
|
62
99
|
"eslint": "^9.18.0",
|
|
63
100
|
"typescript": "^5.9.3",
|
|
64
|
-
"vitest": "^4.
|
|
101
|
+
"vitest": "^4.1.9"
|
|
65
102
|
}
|
|
66
103
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare abstract class BaseCommandBuilder {
|
|
2
|
-
protected command: string;
|
|
3
|
-
protected args: string[];
|
|
4
|
-
constructor(command: string);
|
|
5
|
-
addFlag(flag: string): this;
|
|
6
|
-
protected addOption(option: string, value: string | number): this;
|
|
7
|
-
protected addArg(arg: string): this;
|
|
8
|
-
build(): {
|
|
9
|
-
command: string;
|
|
10
|
-
args: string[];
|
|
11
|
-
};
|
|
12
|
-
reset(): this;
|
|
13
|
-
getArgs(): string[];
|
|
14
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { BaseCommandBuilder } from './BaseCommandBuilder.js';
|
|
2
|
-
import type { FindFilesQuery } from '../tools/local_find_files/scheme.js';
|
|
3
|
-
export declare class FindCommandBuilder extends BaseCommandBuilder {
|
|
4
|
-
private isMacOS;
|
|
5
|
-
private isLinux;
|
|
6
|
-
private isWindows;
|
|
7
|
-
constructor();
|
|
8
|
-
fromQuery(query: Partial<FindFilesQuery> & Pick<FindFilesQuery, 'path'>): this;
|
|
9
|
-
private buildExcludeDirPrune;
|
|
10
|
-
private addFilters;
|
|
11
|
-
simple(path: string, name: string): this;
|
|
12
|
-
entryType(entryType: 'f' | 'd' | 'l'): this;
|
|
13
|
-
name(pattern: string): this;
|
|
14
|
-
maxDepth(depth: number): this;
|
|
15
|
-
minDepth(depth: number): this;
|
|
16
|
-
size(size: string): this;
|
|
17
|
-
mtime(time: string): this;
|
|
18
|
-
path(path: string): this;
|
|
19
|
-
private normalizeRegexForFullPath;
|
|
20
|
-
private parseTimeString;
|
|
21
|
-
private parseTimeStringAccess;
|
|
22
|
-
private normalizeSizeForPlatform;
|
|
23
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BaseCommandBuilder } from './BaseCommandBuilder.js';
|
|
2
|
-
import type { ViewStructureQuery } from '../tools/local_view_structure/scheme.js';
|
|
3
|
-
export declare class LsCommandBuilder extends BaseCommandBuilder {
|
|
4
|
-
constructor();
|
|
5
|
-
fromQuery(query: Partial<ViewStructureQuery> & Pick<ViewStructureQuery, 'path'>): this;
|
|
6
|
-
simple(path: string): this;
|
|
7
|
-
detailed(): this;
|
|
8
|
-
all(): this;
|
|
9
|
-
humanReadable(): this;
|
|
10
|
-
recursive(): this;
|
|
11
|
-
sortBySize(): this;
|
|
12
|
-
sortByTime(): this;
|
|
13
|
-
reverse(): this;
|
|
14
|
-
path(path: string): this;
|
|
15
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { BaseCommandBuilder } from './BaseCommandBuilder.js';
|
|
2
|
-
import type { RipgrepQuery } from '../tools/local_ripgrep/scheme.js';
|
|
3
|
-
export declare class RipgrepCommandBuilder extends BaseCommandBuilder {
|
|
4
|
-
constructor();
|
|
5
|
-
simple(pattern: string, path: string): this;
|
|
6
|
-
filesOnly(): this;
|
|
7
|
-
context(lines: number): this;
|
|
8
|
-
include(pattern: string): this;
|
|
9
|
-
exclude(pattern: string): this;
|
|
10
|
-
excludeDir(dir: string): this;
|
|
11
|
-
type(fileType: string): this;
|
|
12
|
-
fixedString(): this;
|
|
13
|
-
perlRegex(): this;
|
|
14
|
-
maxMatches(count: number): this;
|
|
15
|
-
fromQuery(query: RipgrepQuery): this;
|
|
16
|
-
private _isPlainTextOutput;
|
|
17
|
-
private _applyMatchFlags;
|
|
18
|
-
private _applyContextFlags;
|
|
19
|
-
private _applyOutputModeFlags;
|
|
20
|
-
private _applyFilterFlags;
|
|
21
|
-
private _applyExecutionFlags;
|
|
22
|
-
private _applySortFlags;
|
|
23
|
-
private _applyDiagnosticFlags;
|
|
24
|
-
private _consolidateGlobs;
|
|
25
|
-
private clearSortOption;
|
|
26
|
-
private clearSortrOption;
|
|
27
|
-
}
|
package/dist/hints/dynamic.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { HintContext, HintStatus, ToolHintGenerators } from './types.js';
|
|
2
|
-
export declare const HINTS: Record<string, ToolHintGenerators>;
|
|
3
|
-
type DynamicToolName = keyof typeof HINTS;
|
|
4
|
-
export declare function hasDynamicHints(toolName: string): toolName is DynamicToolName;
|
|
5
|
-
export declare function getDynamicHints(toolName: string, status: HintStatus, context?: HintContext): string[];
|
|
6
|
-
export {};
|
package/dist/hints/index.d.ts
DELETED
package/dist/hints/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { HintContext, HintStatus, ToolHintGenerators, } from '../types/metadata.js';
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { LocalSearchCodeToolResult } from '@octocodeai/octocode-core/extra-types';
|
|
2
|
-
import { type RipgrepQuery } from './scheme.js';
|
|
3
|
-
export declare function executeGrepFallbackSearch(configuredQuery: RipgrepQuery, unavailableReason?: string): Promise<LocalSearchCodeToolResult>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { LocalSearchCodeFile } from '@octocodeai/octocode-core/types';
|
|
2
|
-
import type { RipgrepQuery } from './scheme.js';
|
|
3
|
-
import type { SearchStats } from '../../utils/core/types.js';
|
|
4
|
-
export declare function parseFilesOnlyOutput(stdout: string): LocalSearchCodeFile[];
|
|
5
|
-
export declare function parseCountOutput(stdout: string): LocalSearchCodeFile[];
|
|
6
|
-
export declare function parseRipgrepOutput(stdout: string, configuredQuery: RipgrepQuery): {
|
|
7
|
-
files: LocalSearchCodeFile[];
|
|
8
|
-
stats: SearchStats;
|
|
9
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { DirectoryEntry } from './structureFilters.js';
|
|
2
|
-
export declare function parseLsSimple(output: string, basePath: string, showModified?: boolean): Promise<DirectoryEntry[]>;
|
|
3
|
-
export declare function parseLsLongFormat(output: string, showModified?: boolean): DirectoryEntry[];
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { DirectoryEntry } from './structureFilters.js';
|
|
2
|
-
export interface WalkStats {
|
|
3
|
-
skipped: number;
|
|
4
|
-
permissionDenied: number;
|
|
5
|
-
wasCapped?: boolean;
|
|
6
|
-
rootError?: {
|
|
7
|
-
code: string;
|
|
8
|
-
message: string;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
interface WalkDirectoryOptions {
|
|
12
|
-
basePath: string;
|
|
13
|
-
currentPath: string;
|
|
14
|
-
depth: number;
|
|
15
|
-
maxDepth: number;
|
|
16
|
-
entries: DirectoryEntry[];
|
|
17
|
-
maxEntries?: number;
|
|
18
|
-
showHidden?: boolean;
|
|
19
|
-
showModified?: boolean;
|
|
20
|
-
stats: WalkStats;
|
|
21
|
-
showDetails?: boolean;
|
|
22
|
-
}
|
|
23
|
-
export declare function walkDirectory(options: WalkDirectoryOptions): Promise<void>;
|
|
24
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ToolHintGenerators } from '../../../types/metadata.js';
|
|
2
|
-
import type { SemanticContentType } from '../shared/semanticTypes.js';
|
|
3
|
-
export declare const hints: ToolHintGenerators;
|
|
4
|
-
export declare function semanticHints(type: SemanticContentType, complete: boolean): string[];
|