@octocodeai/octocode-tools-core 16.3.0 → 16.5.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.
Files changed (127) hide show
  1. package/README.md +546 -0
  2. package/dist/config.d.ts +7 -0
  3. package/dist/direct.js +34 -41
  4. package/dist/errors/pathUtils.d.ts +1 -1
  5. package/dist/github/directoryFetch.d.ts +2 -1
  6. package/dist/github/githubAPI.d.ts +10 -1
  7. package/dist/github/repoStructureRecursive.d.ts +6 -0
  8. package/dist/index.d.ts +15 -27
  9. package/dist/index.js +41 -48
  10. package/dist/providers/providerQueries.d.ts +9 -0
  11. package/dist/providers/providerResults.d.ts +2 -0
  12. package/dist/scheme/coreSchemas.d.ts +5 -5
  13. package/dist/scheme/fields.d.ts +6 -6
  14. package/dist/serverConfig.d.ts +1 -1
  15. package/dist/session.d.ts +1 -1
  16. package/dist/shared/config/defaults.d.ts +15 -0
  17. package/dist/shared/config/index.d.ts +10 -0
  18. package/dist/shared/config/index.js +10 -0
  19. package/dist/shared/config/loader.d.ts +7 -0
  20. package/dist/shared/config/resolver.d.ts +2 -0
  21. package/dist/shared/config/resolverCache.d.ts +12 -0
  22. package/dist/shared/config/resolverSections.d.ts +12 -0
  23. package/dist/shared/config/runtimeSurface.d.ts +21 -0
  24. package/dist/shared/config/schemas.d.ts +12 -0
  25. package/dist/shared/config/types.d.ts +100 -0
  26. package/dist/shared/config/validator.d.ts +2 -0
  27. package/dist/shared/credentials/constants.d.ts +2 -0
  28. package/dist/shared/credentials/credentialCache.d.ts +13 -0
  29. package/dist/shared/credentials/credentialEncryption.d.ts +10 -0
  30. package/dist/shared/credentials/credentialUtils.d.ts +4 -0
  31. package/dist/shared/credentials/envTokens.d.ts +9 -0
  32. package/dist/shared/credentials/ghCli.d.ts +1 -0
  33. package/dist/shared/credentials/index.d.ts +3 -0
  34. package/dist/shared/credentials/index.js +9 -0
  35. package/dist/shared/credentials/schemas.d.ts +22 -0
  36. package/dist/shared/credentials/storage.d.ts +30 -0
  37. package/dist/shared/credentials/testing.d.ts +2 -0
  38. package/dist/shared/credentials/testing.js +8 -0
  39. package/dist/shared/credentials/tokenRefresh.d.ts +24 -0
  40. package/dist/shared/credentials/tokenResolution.d.ts +30 -0
  41. package/dist/shared/credentials/types.d.ts +28 -0
  42. package/dist/shared/fs-utils.d.ts +2 -0
  43. package/dist/shared/fs-utils.js +8 -0
  44. package/dist/shared/index.d.ts +7 -0
  45. package/dist/shared/logger/index.d.ts +2 -0
  46. package/dist/shared/logger/logger.d.ts +17 -0
  47. package/dist/shared/paths.d.ts +33 -0
  48. package/dist/shared/paths.js +8 -0
  49. package/dist/shared/platform/index.d.ts +1 -0
  50. package/dist/shared/platform/index.js +8 -0
  51. package/dist/shared/platform/platform.d.ts +8 -0
  52. package/dist/shared/session/index.d.ts +5 -0
  53. package/dist/shared/session/index.js +9 -0
  54. package/dist/shared/session/schemas.d.ts +103 -0
  55. package/dist/shared/session/sessionCache.d.ts +9 -0
  56. package/dist/shared/session/sessionDiskIO.d.ts +6 -0
  57. package/dist/shared/session/statsDefaults.d.ts +4 -0
  58. package/dist/shared/session/storage.d.ts +20 -0
  59. package/dist/shared/session/types.d.ts +53 -0
  60. package/dist/tools/github_clone_repo/cache.d.ts +4 -0
  61. package/dist/tools/github_clone_repo/scheme.d.ts +56 -9
  62. package/dist/tools/github_clone_repo/types.d.ts +1 -1
  63. package/dist/tools/github_fetch_content/scheme.d.ts +8 -4
  64. package/dist/tools/github_fetch_content/types.d.ts +12 -0
  65. package/dist/tools/github_search_code/scheme.d.ts +6 -6
  66. package/dist/tools/github_search_pull_requests/contentResponse.d.ts +0 -1
  67. package/dist/tools/github_search_pull_requests/execution.d.ts +1 -11
  68. package/dist/tools/github_search_pull_requests/scheme.d.ts +6 -2
  69. package/dist/tools/github_search_repos/scheme.d.ts +7 -6
  70. package/dist/tools/github_view_repo_structure/execution.d.ts +0 -9
  71. package/dist/tools/github_view_repo_structure/scheme.d.ts +10 -6
  72. package/dist/tools/local_binary_inspect/archiveOps.d.ts +2 -0
  73. package/dist/tools/local_binary_inspect/binaryInspector.d.ts +48 -7
  74. package/dist/tools/local_binary_inspect/binaryOps.d.ts +16 -7
  75. package/dist/tools/local_binary_inspect/scheme.d.ts +10 -7
  76. package/dist/tools/local_fetch_content/scheme.d.ts +2 -2
  77. package/dist/tools/local_find_files/scheme.d.ts +2 -2
  78. package/dist/tools/local_ripgrep/lspBoost.d.ts +54 -0
  79. package/dist/tools/local_ripgrep/rankingProfile.d.ts +113 -0
  80. package/dist/tools/local_ripgrep/ripgrepResultBuilder.d.ts +10 -1
  81. package/dist/tools/local_ripgrep/scheme.d.ts +29 -4
  82. package/dist/tools/local_ripgrep/structuralSearch.d.ts +3 -4
  83. package/dist/tools/local_view_structure/scheme.d.ts +2 -2
  84. package/dist/tools/local_view_structure/structureFilters.d.ts +1 -3
  85. package/dist/tools/local_view_structure/structureResponse.d.ts +1 -0
  86. package/dist/tools/lsp/semantic_content/scheme.d.ts +4 -8
  87. package/dist/tools/lsp/shared/callHierarchyTraversal.d.ts +2 -2
  88. package/dist/tools/lsp/shared/semanticTypes.d.ts +2 -1
  89. package/dist/tools/package_search/scheme.d.ts +9 -7
  90. package/dist/tools/providerMappers.d.ts +19 -0
  91. package/dist/tools/toolMetadata/proxies.d.ts +0 -6
  92. package/dist/tools/utils.d.ts +3 -7
  93. package/dist/types/bulk.d.ts +0 -2
  94. package/dist/types/execution.d.ts +1 -2
  95. package/dist/types/toolResults.d.ts +2 -3
  96. package/dist/utils/contextUtils.d.ts +35 -2
  97. package/dist/utils/core/lines.d.ts +16 -0
  98. package/dist/utils/core/types.d.ts +10 -0
  99. package/dist/utils/file/filters.d.ts +2 -11
  100. package/dist/utils/parsers/diff.d.ts +18 -0
  101. package/dist/utils/ranking/evidenceRanker.d.ts +86 -0
  102. package/dist/utils/response/error.d.ts +38 -4
  103. package/dist/utils/response/groupedFinalizer.d.ts +0 -2
  104. package/package.json +43 -14
  105. package/dist/commands/RipgrepCommandBuilder.d.ts +0 -27
  106. package/dist/hints/dynamic.d.ts +0 -6
  107. package/dist/hints/index.d.ts +0 -2
  108. package/dist/hints/types.d.ts +0 -1
  109. package/dist/tools/github_clone_repo/hints.d.ts +0 -2
  110. package/dist/tools/github_fetch_content/hints.d.ts +0 -2
  111. package/dist/tools/github_search_code/hints.d.ts +0 -2
  112. package/dist/tools/github_search_pull_requests/hints.d.ts +0 -2
  113. package/dist/tools/github_search_repos/hints.d.ts +0 -2
  114. package/dist/tools/github_view_repo_structure/hints.d.ts +0 -2
  115. package/dist/tools/local_fetch_content/hints.d.ts +0 -2
  116. package/dist/tools/local_find_files/hints.d.ts +0 -2
  117. package/dist/tools/local_ripgrep/grepFallbackExecutor.d.ts +0 -3
  118. package/dist/tools/local_ripgrep/hints.d.ts +0 -2
  119. package/dist/tools/local_ripgrep/ripgrepParser.d.ts +0 -9
  120. package/dist/tools/local_view_structure/hints.d.ts +0 -2
  121. package/dist/tools/local_view_structure/structureParser.d.ts +0 -3
  122. package/dist/tools/local_view_structure/structureWalker.d.ts +0 -24
  123. package/dist/tools/lsp/semantic_content/hints.d.ts +0 -4
  124. package/dist/tools/package_search/hints.d.ts +0 -2
  125. package/dist/types/metadata.d.ts +0 -69
  126. package/dist/utils/exec/commandAvailability.d.ts +0 -19
  127. package/dist/utils/exec/ripgrepBinary.d.ts +0 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octocodeai/octocode-tools-core",
3
- "version": "16.3.0",
3
+ "version": "16.5.1",
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",
@@ -19,48 +19,77 @@
19
19
  "./zod": {
20
20
  "types": "./dist/zod.d.ts",
21
21
  "import": "./dist/zod.js"
22
+ },
23
+ "./credentials": {
24
+ "types": "./dist/shared/credentials/index.d.ts",
25
+ "import": "./dist/shared/credentials/index.js"
26
+ },
27
+ "./platform": {
28
+ "types": "./dist/shared/platform/index.d.ts",
29
+ "import": "./dist/shared/platform/index.js"
30
+ },
31
+ "./session": {
32
+ "types": "./dist/shared/session/index.d.ts",
33
+ "import": "./dist/shared/session/index.js"
34
+ },
35
+ "./config": {
36
+ "types": "./dist/shared/config/index.d.ts",
37
+ "import": "./dist/shared/config/index.js"
38
+ },
39
+ "./paths": {
40
+ "types": "./dist/shared/paths.d.ts",
41
+ "import": "./dist/shared/paths.js"
42
+ },
43
+ "./fs-utils": {
44
+ "types": "./dist/shared/fs-utils.d.ts",
45
+ "import": "./dist/shared/fs-utils.js"
46
+ },
47
+ "./testing": {
48
+ "types": "./dist/shared/credentials/testing.d.ts",
49
+ "import": "./dist/shared/credentials/testing.js"
22
50
  }
23
51
  },
24
52
  "files": [
25
53
  "dist",
26
- "LICENSE"
54
+ "LICENSE",
55
+ "README.md"
27
56
  ],
28
57
  "engines": {
29
58
  "node": ">=20.0.0"
30
59
  },
31
60
  "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",
61
+ "build": "yarn readme:sync && yarn clean && node build.mjs && tsc --emitDeclarationOnly -p tsconfig.build.json",
62
+ "build:dev": "yarn readme:sync && node build.mjs && tsc --emitDeclarationOnly -p tsconfig.build.json",
34
63
  "clean": "rm -rf dist/",
35
64
  "lint": "eslint src",
36
65
  "lint:fix": "eslint src --fix",
37
66
  "test": "vitest run --coverage",
38
67
  "test:quiet": "vitest run --reporter=dot --silent",
39
68
  "typecheck": "tsc --noEmit --skipLibCheck -p tsconfig.json",
40
- "verify": "yarn lint && yarn typecheck && yarn test"
69
+ "verify": "yarn lint && yarn typecheck && yarn test",
70
+ "readme:sync": "node ../../scripts/sync-package-readmes.mjs .",
71
+ "prepack": "yarn readme:sync"
41
72
  },
42
73
  "dependencies": {
43
74
  "@modelcontextprotocol/sdk": "^1.29.0",
44
- "@octocodeai/octocode-context-utils": "^16.3.0",
45
- "@octocodeai/octocode-core": "^16.2.0",
75
+ "@octocodeai/octocode-core": "^16.5.1",
76
+ "@octocodeai/octocode-engine": "^16.5.1",
77
+ "@octokit/oauth-methods": "^6.0.2",
46
78
  "@octokit/plugin-throttling": "^11.0.3",
47
- "@vscode/ripgrep": "^1.18.0",
79
+ "@octokit/request": "^10.0.10",
48
80
  "node-cache": "^5.1.2",
49
- "octocode-lsp": "^16.3.0",
50
- "octocode-security": "^16.3.0",
51
- "octocode-shared": "workspace:^",
52
81
  "octokit": "^5.0.5",
53
- "zod": "^4.3.6"
82
+ "zod": "^4.4.3"
54
83
  },
55
84
  "devDependencies": {
56
85
  "@octokit/core": "^7.0.6",
57
86
  "@octokit/openapi-types": "^27.0.0",
58
87
  "@octokit/plugin-rest-endpoint-methods": "^17.0.0",
59
88
  "@types/node": "^25.9.3",
60
- "@vitest/coverage-v8": "^4.0.16",
89
+ "@vitest/coverage-v8": "^4.1.9",
61
90
  "esbuild": "^0.28.1",
62
91
  "eslint": "^9.18.0",
63
92
  "typescript": "^5.9.3",
64
- "vitest": "^4.0.16"
93
+ "vitest": "^4.1.9"
65
94
  }
66
95
  }
@@ -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
- }
@@ -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 {};
@@ -1,2 +0,0 @@
1
- import type { HintContext, HintStatus } from './types.js';
2
- export declare function getHints(toolName: string, status: HintStatus, context?: HintContext): string[];
@@ -1 +0,0 @@
1
- export type { HintContext, HintStatus, ToolHintGenerators, } from '../types/metadata.js';
@@ -1,2 +0,0 @@
1
- import type { ToolHintGenerators } from '../../types/metadata.js';
2
- export declare const hints: ToolHintGenerators;
@@ -1,2 +0,0 @@
1
- import type { ToolHintGenerators } from '../../types/metadata.js';
2
- export declare const hints: ToolHintGenerators;
@@ -1,2 +0,0 @@
1
- import type { ToolHintGenerators } from '../../types/metadata.js';
2
- export declare const hints: ToolHintGenerators;
@@ -1,2 +0,0 @@
1
- import type { ToolHintGenerators } from '../../types/metadata.js';
2
- export declare const hints: ToolHintGenerators;
@@ -1,2 +0,0 @@
1
- import type { ToolHintGenerators } from '../../types/metadata.js';
2
- export declare const hints: ToolHintGenerators;
@@ -1,2 +0,0 @@
1
- import type { ToolHintGenerators } from '../../types/metadata.js';
2
- export declare const hints: ToolHintGenerators;
@@ -1,2 +0,0 @@
1
- import type { ToolHintGenerators } from '../../types/metadata.js';
2
- export declare const hints: ToolHintGenerators;
@@ -1,2 +0,0 @@
1
- import type { ToolHintGenerators } from '../../types/metadata.js';
2
- export declare const hints: ToolHintGenerators;
@@ -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,2 +0,0 @@
1
- import type { ToolHintGenerators } from '../../types/metadata.js';
2
- export declare const hints: ToolHintGenerators;
@@ -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,2 +0,0 @@
1
- import type { ToolHintGenerators } from '../../types/metadata.js';
2
- export declare const hints: ToolHintGenerators;
@@ -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[];
@@ -1,2 +0,0 @@
1
- import type { ToolHintGenerators } from '../../types/metadata.js';
2
- export declare const hints: ToolHintGenerators;
@@ -1,69 +0,0 @@
1
- export type HintStatus = 'empty' | 'error';
2
- export interface HintContext {
3
- fileSize?: number;
4
- resultSize?: number;
5
- tokenEstimate?: number;
6
- entryCount?: number;
7
- matchCount?: number;
8
- fileCount?: number;
9
- isLarge?: boolean;
10
- errorType?: 'size_limit' | 'not_found' | 'directory' | 'permission' | 'pattern_too_broad' | 'symbol_not_found' | 'file_not_found' | 'timeout' | 'not_a_function' | 'rate_limit' | 'lsp_unavailable';
11
- originalError?: string;
12
- status?: number;
13
- isRateLimited?: boolean;
14
- retryAfter?: number;
15
- rateLimitRemaining?: number;
16
- hasPattern?: boolean;
17
- hasPagination?: boolean;
18
- path?: string;
19
- hasOwnerRepo?: boolean;
20
- match?: 'file' | 'path';
21
- searchEngine?: 'rg' | 'grep';
22
- wasFilteredToEmpty?: boolean;
23
- hasConfigFiles?: boolean;
24
- owner?: string;
25
- repo?: string;
26
- branch?: string;
27
- extension?: string;
28
- filename?: string;
29
- keywords?: string[];
30
- state?: string;
31
- author?: string;
32
- query?: string;
33
- prNumber?: number;
34
- locationCount?: number;
35
- hasExternalPackage?: boolean;
36
- isFallback?: boolean;
37
- searchRadius?: number;
38
- lineHint?: number;
39
- symbolName?: string;
40
- uri?: string;
41
- hasMultipleFiles?: boolean;
42
- hasMorePages?: boolean;
43
- currentPage?: number;
44
- totalPages?: number;
45
- direction?: 'incoming' | 'outgoing';
46
- callCount?: number;
47
- depth?: number;
48
- hasMoreContent?: boolean;
49
- isPartial?: boolean;
50
- endLine?: number;
51
- totalLines?: number;
52
- nextCharOffset?: number;
53
- totalChars?: number;
54
- filteredAll?: boolean;
55
- matchedPaths?: string[];
56
- totalMatches?: number;
57
- hasMore?: boolean;
58
- flagFiles?: string[];
59
- language?: string;
60
- topic?: string;
61
- prMatch?: string[];
62
- type?: string;
63
- }
64
- type HintGenerator = (context: HintContext) => (string | undefined)[];
65
- export interface ToolHintGenerators {
66
- empty: HintGenerator;
67
- error: HintGenerator;
68
- }
69
- export {};
@@ -1,19 +0,0 @@
1
- interface CommandAvailabilityResult {
2
- available: boolean;
3
- command: string;
4
- version?: string;
5
- error?: string;
6
- }
7
- export declare const REQUIRED_COMMANDS: {
8
- readonly rg: {
9
- readonly name: "ripgrep";
10
- readonly versionFlag: "--version";
11
- readonly tool: "localSearchCode";
12
- };
13
- };
14
- type CommandName = keyof typeof REQUIRED_COMMANDS;
15
- export declare function checkCommandAvailability(command: CommandName, forceCheck?: boolean): Promise<CommandAvailabilityResult>;
16
- export declare function checkAllCommandsAvailability(): Promise<Map<CommandName, CommandAvailabilityResult>>;
17
- export declare function getMissingCommandError(command: CommandName): string;
18
- export declare function clearAvailabilityCache(): void;
19
- export {};
@@ -1,3 +0,0 @@
1
- export declare function resolveRipgrepBinary(): string;
2
- export declare function allowRipgrepCommandName(binaryPath: string): void;
3
- export declare function resolveRgFromPath(): string | null;