octocode-mcp 13.0.0 → 14.0.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.
Files changed (240) hide show
  1. package/dist/bitbucket/client.d.ts +23 -0
  2. package/dist/bitbucket/codeSearch.d.ts +21 -0
  3. package/dist/bitbucket/errors.d.ts +46 -0
  4. package/dist/bitbucket/fileContent.d.ts +21 -0
  5. package/dist/bitbucket/pullRequestSearch.d.ts +43 -0
  6. package/dist/bitbucket/repoSearch.d.ts +28 -0
  7. package/dist/bitbucket/repoStructure.d.ts +31 -0
  8. package/dist/bitbucket/searchUtils.d.ts +9 -0
  9. package/dist/bitbucket/types.d.ts +220 -0
  10. package/dist/bitbucketConfig.d.ts +11 -0
  11. package/dist/commands/BaseCommandBuilder.d.ts +39 -0
  12. package/dist/commands/FindCommandBuilder.d.ts +73 -0
  13. package/dist/commands/GrepCommandBuilder.d.ts +69 -0
  14. package/dist/commands/LsCommandBuilder.d.ts +51 -0
  15. package/dist/commands/RipgrepCommandBuilder.d.ts +61 -0
  16. package/dist/errors/ToolError.d.ts +52 -0
  17. package/dist/errors/domainErrors.d.ts +314 -0
  18. package/dist/errors/errorFactories.d.ts +14 -0
  19. package/dist/errors/localToolErrors.d.ts +47 -0
  20. package/dist/errors/pathUtils.d.ts +1 -0
  21. package/dist/github/client.d.ts +26 -0
  22. package/dist/github/codeSearch.d.ts +4 -0
  23. package/dist/github/directoryFetch.d.ts +31 -0
  24. package/dist/github/errorConstants.d.ts +173 -0
  25. package/dist/github/errors.d.ts +2 -0
  26. package/dist/github/fileContent.d.ts +11 -0
  27. package/dist/github/fileContentProcess.d.ts +20 -0
  28. package/dist/github/fileContentRaw.d.ts +10 -0
  29. package/dist/github/githubAPI.d.ts +205 -0
  30. package/dist/github/prByNumber.d.ts +9 -0
  31. package/dist/github/prContentFetcher.d.ts +9 -0
  32. package/dist/github/prTransformation.d.ts +101 -0
  33. package/dist/github/pullRequestSearch.d.ts +12 -0
  34. package/dist/github/queryBuilders.d.ts +7 -0
  35. package/dist/github/repoSearch.d.ts +16 -0
  36. package/dist/github/repoStructure.d.ts +4 -0
  37. package/dist/github/repoStructurePagination.d.ts +11 -0
  38. package/dist/github/repoStructureRecursive.d.ts +10 -0
  39. package/dist/gitlab/client.d.ts +68 -0
  40. package/dist/gitlab/codeSearch.d.ts +29 -0
  41. package/dist/gitlab/errors.d.ts +65 -0
  42. package/dist/gitlab/fileContent.d.ts +44 -0
  43. package/dist/gitlab/mergeRequests.d.ts +68 -0
  44. package/dist/gitlab/projectsSearch.d.ts +56 -0
  45. package/dist/gitlab/repoStructure.d.ts +58 -0
  46. package/dist/gitlab/types.d.ts +339 -0
  47. package/dist/gitlabConfig.d.ts +20 -0
  48. package/dist/hints/dynamic.d.ts +37 -0
  49. package/dist/hints/index.d.ts +44 -0
  50. package/dist/hints/localToolUsageHints.d.ts +12 -0
  51. package/dist/hints/static.d.ts +24 -0
  52. package/dist/hints/types.d.ts +5 -0
  53. package/dist/index.d.ts +3 -74
  54. package/dist/index.js +301 -261
  55. package/dist/lsp/client.d.ts +66 -0
  56. package/dist/lsp/config.d.ts +48 -0
  57. package/dist/lsp/lspDocumentManager.d.ts +41 -0
  58. package/dist/lsp/lspOperations.d.ts +65 -0
  59. package/dist/lsp/lspRegistry.d.ts +9 -0
  60. package/dist/lsp/manager.d.ts +39 -0
  61. package/dist/lsp/resolver.d.ts +116 -0
  62. package/dist/lsp/schemas.d.ts +17 -0
  63. package/dist/lsp/symbols.d.ts +27 -0
  64. package/dist/lsp/types.d.ts +237 -0
  65. package/dist/lsp/uri.d.ts +31 -0
  66. package/dist/lsp/validation.d.ts +46 -0
  67. package/dist/lsp/workspaceRoot.d.ts +2 -0
  68. package/dist/prompts/prompts.d.ts +7 -0
  69. package/dist/providers/bitbucket/BitbucketProvider.d.ts +21 -0
  70. package/dist/providers/bitbucket/bitbucketContent.d.ts +4 -0
  71. package/dist/providers/bitbucket/bitbucketPullRequests.d.ts +12 -0
  72. package/dist/providers/bitbucket/bitbucketSearch.d.ts +11 -0
  73. package/dist/providers/bitbucket/bitbucketStructure.d.ts +2 -0
  74. package/dist/providers/bitbucket/utils.d.ts +10 -0
  75. package/dist/providers/capabilities.d.ts +2 -0
  76. package/dist/providers/contentExtraction.d.ts +12 -0
  77. package/dist/providers/factory.d.ts +91 -0
  78. package/dist/providers/github/GitHubProvider.d.ts +37 -0
  79. package/dist/providers/github/githubContent.d.ts +22 -0
  80. package/dist/providers/github/githubPullRequests.d.ts +25 -0
  81. package/dist/providers/github/githubSearch.d.ts +31 -0
  82. package/dist/providers/github/githubStructure.d.ts +22 -0
  83. package/dist/providers/github/utils.d.ts +8 -0
  84. package/dist/providers/gitlab/GitLabProvider.d.ts +28 -0
  85. package/dist/providers/gitlab/gitlabContent.d.ts +19 -0
  86. package/dist/providers/gitlab/gitlabPullRequests.d.ts +71 -0
  87. package/dist/providers/gitlab/gitlabSearch.d.ts +34 -0
  88. package/dist/providers/gitlab/gitlabStructure.d.ts +14 -0
  89. package/dist/providers/gitlab/utils.d.ts +31 -0
  90. package/dist/providers/providerQueries.d.ts +225 -0
  91. package/dist/providers/providerResults.d.ts +234 -0
  92. package/dist/providers/pullRequestFileChanges.d.ts +21 -0
  93. package/dist/providers/types.d.ts +99 -0
  94. package/dist/public/responses.d.ts +5 -0
  95. package/dist/public/server.d.ts +11 -0
  96. package/dist/public/session.d.ts +5 -0
  97. package/dist/public/tools.d.ts +32 -0
  98. package/dist/public.d.ts +15 -3722
  99. package/dist/public.js +283 -248
  100. package/dist/responses.d.ts +109 -0
  101. package/dist/serverConfig.d.ts +65 -0
  102. package/dist/session.d.ts +32 -0
  103. package/dist/tools/executionGuard.d.ts +18 -0
  104. package/dist/tools/github_clone_repo/cache.d.ts +95 -0
  105. package/dist/tools/github_clone_repo/cloneRepo.d.ts +35 -0
  106. package/dist/tools/github_clone_repo/execution.d.ts +10 -0
  107. package/dist/tools/github_clone_repo/hints.d.ts +10 -0
  108. package/dist/tools/github_clone_repo/register.d.ts +10 -0
  109. package/dist/tools/github_clone_repo/types.d.ts +19 -0
  110. package/dist/tools/github_fetch_content/execution.d.ts +4 -0
  111. package/dist/tools/github_fetch_content/github_fetch_content.d.ts +1 -0
  112. package/dist/tools/github_fetch_content/hints.d.ts +6 -0
  113. package/dist/tools/github_fetch_content/types.d.ts +51 -0
  114. package/dist/tools/github_search_code/execution.d.ts +4 -0
  115. package/dist/tools/github_search_code/github_search_code.d.ts +1 -0
  116. package/dist/tools/github_search_code/hints.d.ts +6 -0
  117. package/dist/tools/github_search_pull_requests/execution.d.ts +4 -0
  118. package/dist/tools/github_search_pull_requests/github_search_pull_requests.d.ts +1 -0
  119. package/dist/tools/github_search_pull_requests/hints.d.ts +6 -0
  120. package/dist/tools/github_search_pull_requests/types.d.ts +80 -0
  121. package/dist/tools/github_search_repos/execution.d.ts +4 -0
  122. package/dist/tools/github_search_repos/github_search_repos.d.ts +1 -0
  123. package/dist/tools/github_search_repos/hints.d.ts +6 -0
  124. package/dist/tools/github_view_repo_structure/constants.d.ts +5 -0
  125. package/dist/tools/github_view_repo_structure/execution.d.ts +4 -0
  126. package/dist/tools/github_view_repo_structure/github_view_repo_structure.d.ts +1 -0
  127. package/dist/tools/github_view_repo_structure/hints.d.ts +6 -0
  128. package/dist/tools/github_view_repo_structure/types.d.ts +34 -0
  129. package/dist/tools/local_fetch_content/contentExtractor.d.ts +8 -0
  130. package/dist/tools/local_fetch_content/contentMinifier.d.ts +9 -0
  131. package/dist/tools/local_fetch_content/execution.d.ts +9 -0
  132. package/dist/tools/local_fetch_content/fetchContent.d.ts +2 -0
  133. package/dist/tools/local_fetch_content/hints.d.ts +13 -0
  134. package/dist/tools/local_fetch_content/register.d.ts +6 -0
  135. package/dist/tools/local_find_files/execution.d.ts +9 -0
  136. package/dist/tools/local_find_files/findFiles.d.ts +2 -0
  137. package/dist/tools/local_find_files/hints.d.ts +8 -0
  138. package/dist/tools/local_find_files/register.d.ts +6 -0
  139. package/dist/tools/local_ripgrep/execution.d.ts +9 -0
  140. package/dist/tools/local_ripgrep/hints.d.ts +13 -0
  141. package/dist/tools/local_ripgrep/register.d.ts +6 -0
  142. package/dist/tools/local_ripgrep/ripgrepExecutor.d.ts +15 -0
  143. package/dist/tools/local_ripgrep/ripgrepParser.d.ts +32 -0
  144. package/dist/tools/local_ripgrep/ripgrepResultBuilder.d.ts +8 -0
  145. package/dist/tools/local_ripgrep/searchContentRipgrep.d.ts +6 -0
  146. package/dist/tools/local_ripgrep/types.d.ts +8 -0
  147. package/dist/tools/local_view_structure/execution.d.ts +9 -0
  148. package/dist/tools/local_view_structure/hints.d.ts +6 -0
  149. package/dist/tools/local_view_structure/local_view_structure.d.ts +2 -0
  150. package/dist/tools/local_view_structure/register.d.ts +6 -0
  151. package/dist/tools/local_view_structure/structureFilters.d.ts +33 -0
  152. package/dist/tools/local_view_structure/structureParser.d.ts +3 -0
  153. package/dist/tools/local_view_structure/structureWalker.d.ts +18 -0
  154. package/dist/tools/lsp_call_hierarchy/callHierarchy.d.ts +13 -0
  155. package/dist/tools/lsp_call_hierarchy/callHierarchyHelpers.d.ts +67 -0
  156. package/dist/tools/lsp_call_hierarchy/callHierarchyLsp.d.ts +20 -0
  157. package/dist/tools/lsp_call_hierarchy/callHierarchyPatterns.d.ts +30 -0
  158. package/dist/tools/lsp_call_hierarchy/constants.d.ts +1 -0
  159. package/dist/tools/lsp_call_hierarchy/execution.d.ts +8 -0
  160. package/dist/tools/lsp_call_hierarchy/hints.d.ts +9 -0
  161. package/dist/tools/lsp_call_hierarchy/register.d.ts +5 -0
  162. package/dist/tools/lsp_find_references/constants.d.ts +1 -0
  163. package/dist/tools/lsp_find_references/execution.d.ts +8 -0
  164. package/dist/tools/lsp_find_references/hints.d.ts +9 -0
  165. package/dist/tools/lsp_find_references/lspReferencesCore.d.ts +31 -0
  166. package/dist/tools/lsp_find_references/lspReferencesPatterns.d.ts +54 -0
  167. package/dist/tools/lsp_find_references/lsp_find_references.d.ts +26 -0
  168. package/dist/tools/lsp_find_references/register.d.ts +2 -0
  169. package/dist/tools/lsp_goto_definition/execution.d.ts +48 -0
  170. package/dist/tools/lsp_goto_definition/hints.d.ts +9 -0
  171. package/dist/tools/lsp_goto_definition/lsp_goto_definition.d.ts +10 -0
  172. package/dist/tools/lsp_goto_definition/types.d.ts +1 -0
  173. package/dist/tools/metadataPolicy.d.ts +7 -0
  174. package/dist/tools/package_search/execution.d.ts +4 -0
  175. package/dist/tools/package_search/hints.d.ts +6 -0
  176. package/dist/tools/package_search/package_search.d.ts +3 -0
  177. package/dist/tools/package_search/types.d.ts +12 -0
  178. package/dist/tools/providerExecution.d.ts +56 -0
  179. package/dist/tools/providerMappers.d.ts +160 -0
  180. package/dist/tools/registerRemoteTool.d.ts +34 -0
  181. package/dist/tools/registrationExecutor.d.ts +18 -0
  182. package/dist/tools/toolConfig.d.ts +35 -0
  183. package/dist/tools/toolFilters.d.ts +20 -0
  184. package/dist/tools/toolMetadata/baseSchema.d.ts +2 -0
  185. package/dist/tools/toolMetadata/descriptions.d.ts +1 -0
  186. package/dist/tools/toolMetadata/gateway.d.ts +7 -0
  187. package/dist/tools/toolMetadata/genericErrorHints.d.ts +1 -0
  188. package/dist/tools/toolMetadata/hints.d.ts +14 -0
  189. package/dist/tools/toolMetadata/metadataPresence.d.ts +1 -0
  190. package/dist/tools/toolMetadata/names.d.ts +2 -0
  191. package/dist/tools/toolMetadata/proxies.d.ts +17 -0
  192. package/dist/tools/toolMetadata/state.d.ts +7 -0
  193. package/dist/tools/toolMetadata/types.d.ts +8 -0
  194. package/dist/tools/toolNames.d.ts +2 -0
  195. package/dist/tools/toolsManager.d.ts +19 -0
  196. package/dist/tools/utils.d.ts +69 -0
  197. package/dist/types/execution.d.ts +39 -0
  198. package/dist/types/metadata.d.ts +59 -0
  199. package/dist/types/responseTypes.d.ts +118 -0
  200. package/dist/types/toolTypes.d.ts +16 -0
  201. package/dist/types.d.ts +228 -0
  202. package/dist/utils/core/constants.d.ts +96 -0
  203. package/dist/utils/core/logger.d.ts +41 -0
  204. package/dist/utils/core/promise.d.ts +2 -0
  205. package/dist/utils/core/safeRegex.d.ts +25 -0
  206. package/dist/utils/core/types.d.ts +50 -0
  207. package/dist/utils/environment/environmentDetection.d.ts +5 -0
  208. package/dist/utils/exec/commandAvailability.d.ts +63 -0
  209. package/dist/utils/exec/npm.d.ts +38 -0
  210. package/dist/utils/exec/safe.d.ts +13 -0
  211. package/dist/utils/exec/spawn.d.ts +96 -0
  212. package/dist/utils/file/byteOffset.d.ts +99 -0
  213. package/dist/utils/file/filters.d.ts +42 -0
  214. package/dist/utils/file/size.d.ts +17 -0
  215. package/dist/utils/file/toolHelpers.d.ts +44 -0
  216. package/dist/utils/file/types.d.ts +5 -0
  217. package/dist/utils/http/cache.d.ts +26 -0
  218. package/dist/utils/http/fetch.d.ts +63 -0
  219. package/dist/utils/minifier/jsonToYamlString.d.ts +5 -0
  220. package/dist/utils/minifier/minifier.d.ts +20 -0
  221. package/dist/utils/minifier/minifierStrategies.d.ts +68 -0
  222. package/dist/utils/minifier/minifierTypes.d.ts +26 -0
  223. package/dist/utils/package/common.d.ts +65 -0
  224. package/dist/utils/package/npm.d.ts +20 -0
  225. package/dist/utils/package/python.d.ts +2 -0
  226. package/dist/utils/package/schemas.d.ts +66 -0
  227. package/dist/utils/package/types.d.ts +52 -0
  228. package/dist/utils/pagination/core.d.ts +33 -0
  229. package/dist/utils/pagination/hints.d.ts +19 -0
  230. package/dist/utils/pagination/outputSizeLimit.d.ts +54 -0
  231. package/dist/utils/pagination/types.d.ts +101 -0
  232. package/dist/utils/parsers/diff.d.ts +1 -0
  233. package/dist/utils/parsers/ripgrep.d.ts +12 -0
  234. package/dist/utils/parsers/schemas.d.ts +102 -0
  235. package/dist/utils/response/bulk.d.ts +17 -0
  236. package/dist/utils/response/error.d.ts +39 -0
  237. package/dist/utils/response/structuredPagination.d.ts +8 -0
  238. package/dist/utils/secureServer.d.ts +26 -0
  239. package/dist/utils/securityBridge.d.ts +23 -0
  240. package/package.json +74 -72
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Bitbucket Client
3
+ *
4
+ * Manages Bitbucket Cloud client instances with caching and configuration.
5
+ * Uses @coderabbitai/bitbucket for typed API calls.
6
+ *
7
+ * @module bitbucket/client
8
+ */
9
+ import { BitbucketCloud } from '@coderabbitai/bitbucket';
10
+ type BitbucketClient = ReturnType<typeof BitbucketCloud.createBitbucketCloudClient>;
11
+ interface ClientConfig {
12
+ token?: string;
13
+ host?: string;
14
+ username?: string;
15
+ }
16
+ export declare function getBitbucketClient(config?: ClientConfig): BitbucketClient;
17
+ export declare function clearBitbucketClients(): void;
18
+ export declare function clearBitbucketClient(config?: ClientConfig): void;
19
+ export declare function getCachedDefaultBranch(projectId: string): string | undefined;
20
+ export declare function cacheDefaultBranch(projectId: string, branch: string): void;
21
+ export declare function clearDefaultBranchCache(): void;
22
+ export declare function getAuthHeader(config?: ClientConfig): string;
23
+ export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Bitbucket Code Search
3
+ *
4
+ * Search for code within a Bitbucket workspace.
5
+ * Bitbucket scopes code search to workspace level, not individual repos.
6
+ *
7
+ * @module bitbucket/codeSearch
8
+ */
9
+ import type { BitbucketAPIResponse, BitbucketCodeSearchResult } from './types.js';
10
+ interface BitbucketCodeSearchQuery {
11
+ workspace: string;
12
+ repoSlug?: string;
13
+ searchQuery: string;
14
+ path?: string;
15
+ filename?: string;
16
+ extension?: string;
17
+ page?: number;
18
+ limit?: number;
19
+ }
20
+ export declare function searchBitbucketCodeAPI(params: BitbucketCodeSearchQuery): Promise<BitbucketAPIResponse<BitbucketCodeSearchResult>>;
21
+ export {};
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Bitbucket Error Handling
3
+ *
4
+ * Handles Bitbucket API errors and transforms them to standardized format.
5
+ *
6
+ * @module bitbucket/errors
7
+ */
8
+ import type { BitbucketAPIError, BitbucketAPIResponse } from './types.js';
9
+ export declare const BITBUCKET_ERROR_CODES: {
10
+ readonly RATE_LIMITED: {
11
+ readonly code: "BB_RATE_LIMITED";
12
+ readonly message: "Bitbucket API rate limit exceeded. Please wait before retrying.";
13
+ };
14
+ readonly UNAUTHORIZED: {
15
+ readonly code: "BB_UNAUTHORIZED";
16
+ readonly message: "Bitbucket authentication failed. Check your BITBUCKET_TOKEN.";
17
+ };
18
+ readonly FORBIDDEN: {
19
+ readonly code: "BB_FORBIDDEN";
20
+ readonly message: "Access denied. Check Bitbucket app password permissions.";
21
+ };
22
+ readonly NOT_FOUND: {
23
+ readonly code: "BB_NOT_FOUND";
24
+ readonly message: "Resource not found. Check the workspace, repo slug, and path.";
25
+ };
26
+ readonly BAD_REQUEST: {
27
+ readonly code: "BB_BAD_REQUEST";
28
+ readonly message: "Invalid request parameters.";
29
+ };
30
+ readonly SERVER_ERROR: {
31
+ readonly code: "BB_SERVER_ERROR";
32
+ readonly message: "Bitbucket server error. Please try again later.";
33
+ };
34
+ readonly NETWORK_ERROR: {
35
+ readonly code: "BB_NETWORK_ERROR";
36
+ readonly message: "Network error connecting to Bitbucket.";
37
+ };
38
+ };
39
+ export declare function handleBitbucketAPIError(error: unknown): BitbucketAPIError;
40
+ export declare function createBitbucketError(message: string, status?: number, hints?: string[]): BitbucketAPIResponse<never>;
41
+ export declare function isRateLimitError(error: BitbucketAPIError): boolean;
42
+ export declare function extractRateLimitFromHeaders(headers: Headers): {
43
+ remaining?: number;
44
+ reset?: number;
45
+ retryAfter?: number;
46
+ };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Bitbucket File Content
3
+ *
4
+ * Retrieve file contents from Bitbucket repositories.
5
+ * Bitbucket returns raw text for file content (not JSON-wrapped).
6
+ *
7
+ * @module bitbucket/fileContent
8
+ */
9
+ import type { BitbucketAPIResponse, BitbucketFileContentResult } from './types.js';
10
+ interface BitbucketFileContentQuery {
11
+ workspace: string;
12
+ repoSlug: string;
13
+ path: string;
14
+ ref?: string;
15
+ }
16
+ export declare function fetchBitbucketFileContentAPI(params: BitbucketFileContentQuery): Promise<BitbucketAPIResponse<BitbucketFileContentResult>>;
17
+ /**
18
+ * Resolve the default branch for a Bitbucket repository.
19
+ */
20
+ export declare function getBitbucketDefaultBranch(workspace: string, repoSlug: string): Promise<string>;
21
+ export {};
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Bitbucket Pull Request Search
3
+ *
4
+ * Search and retrieve pull requests from Bitbucket repositories.
5
+ *
6
+ * @module bitbucket/pullRequestSearch
7
+ */
8
+ import type { BitbucketAPIResponse, BitbucketPullRequest, BitbucketPRComment, BitbucketDiffstatEntry } from './types.js';
9
+ interface BitbucketPRSearchQuery {
10
+ workspace: string;
11
+ repoSlug: string;
12
+ prNumber?: number;
13
+ state?: 'OPEN' | 'MERGED' | 'DECLINED' | 'SUPERSEDED';
14
+ author?: string;
15
+ baseBranch?: string;
16
+ headBranch?: string;
17
+ sort?: string;
18
+ page?: number;
19
+ limit?: number;
20
+ withComments?: boolean;
21
+ withDiff?: boolean;
22
+ withDiffstat?: boolean;
23
+ }
24
+ interface BitbucketPRSearchResult {
25
+ pullRequests: BitbucketPullRequest[];
26
+ pagination: {
27
+ currentPage: number;
28
+ totalPages: number;
29
+ hasMore: boolean;
30
+ totalMatches?: number;
31
+ };
32
+ comments?: BitbucketPRComment[];
33
+ diff?: string;
34
+ diffstat?: BitbucketDiffstatEntry[];
35
+ }
36
+ interface BitbucketPRSupplementalData {
37
+ comments?: BitbucketPRComment[];
38
+ diff?: string;
39
+ diffstat?: BitbucketDiffstatEntry[];
40
+ }
41
+ export declare function searchBitbucketPRsAPI(params: BitbucketPRSearchQuery): Promise<BitbucketAPIResponse<BitbucketPRSearchResult>>;
42
+ export declare function fetchBitbucketPRSupplementalData(params: BitbucketPRSearchQuery): Promise<BitbucketPRSupplementalData>;
43
+ export {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Bitbucket Repository Search
3
+ *
4
+ * List and search repositories within a Bitbucket workspace.
5
+ *
6
+ * @module bitbucket/repoSearch
7
+ */
8
+ import type { BitbucketAPIResponse, BitbucketRepository } from './types.js';
9
+ interface BitbucketRepoSearchQuery {
10
+ workspace: string;
11
+ keywords?: string[];
12
+ topics?: string[];
13
+ visibility?: string;
14
+ sort?: string;
15
+ page?: number;
16
+ limit?: number;
17
+ }
18
+ interface BitbucketRepoSearchResult {
19
+ repositories: BitbucketRepository[];
20
+ pagination: {
21
+ currentPage: number;
22
+ totalPages: number;
23
+ hasMore: boolean;
24
+ totalMatches?: number;
25
+ };
26
+ }
27
+ export declare function searchBitbucketReposAPI(params: BitbucketRepoSearchQuery): Promise<BitbucketAPIResponse<BitbucketRepoSearchResult>>;
28
+ export {};
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Bitbucket Repository Structure
3
+ *
4
+ * Browse repository tree structure on Bitbucket.
5
+ * Uses the same /src/{commit}/{path} endpoint with format=meta for directory listing.
6
+ *
7
+ * @module bitbucket/repoStructure
8
+ */
9
+ import type { BitbucketAPIResponse, BitbucketTreeEntry } from './types.js';
10
+ interface BitbucketRepoStructureQuery {
11
+ workspace: string;
12
+ repoSlug: string;
13
+ ref?: string;
14
+ path?: string;
15
+ depth?: number;
16
+ entriesPerPage?: number;
17
+ entryPageNumber?: number;
18
+ }
19
+ interface BitbucketRepoStructureResult {
20
+ entries: BitbucketTreeEntry[];
21
+ branch: string;
22
+ path: string;
23
+ pagination: {
24
+ currentPage: number;
25
+ totalPages: number;
26
+ hasMore: boolean;
27
+ totalMatches?: number;
28
+ };
29
+ }
30
+ export declare function viewBitbucketRepoStructureAPI(params: BitbucketRepoStructureQuery): Promise<BitbucketAPIResponse<BitbucketRepoStructureResult>>;
31
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { BitbucketCodeSearchItem } from './types.js';
2
+ interface BitbucketRepositoryIdentity {
3
+ workspace: string;
4
+ repoSlug: string;
5
+ }
6
+ export declare function parseBitbucketRepositoryIdentityFromUrl(href?: string): BitbucketRepositoryIdentity | undefined;
7
+ export declare function getBitbucketRepositoryIdentity(item: BitbucketCodeSearchItem): BitbucketRepositoryIdentity | undefined;
8
+ export declare function formatBitbucketRepositoryIdentity(identity?: BitbucketRepositoryIdentity): string;
9
+ export {};
@@ -0,0 +1,220 @@
1
+ /**
2
+ * Bitbucket API Types
3
+ *
4
+ * Types for Bitbucket Cloud REST API responses.
5
+ *
6
+ * @module bitbucket/types
7
+ */
8
+ export interface BitbucketAPIError {
9
+ error: string;
10
+ status: number;
11
+ type: 'http' | 'network' | 'unknown';
12
+ rateLimitRemaining?: number;
13
+ /** Rate limit reset time in **seconds** (Unix timestamp from `x-ratelimit-reset` header). */
14
+ rateLimitReset?: number;
15
+ retryAfter?: number;
16
+ hints?: string[];
17
+ }
18
+ export type BitbucketAPIResponse<T> = {
19
+ data: T;
20
+ status: number;
21
+ } | BitbucketAPIError;
22
+ export interface BitbucketPaginatedResponse<T> {
23
+ values: T[];
24
+ page?: number;
25
+ pagelen?: number;
26
+ size?: number;
27
+ next?: string;
28
+ previous?: string;
29
+ }
30
+ interface BitbucketCodeSearchSegment {
31
+ text: string;
32
+ match?: boolean;
33
+ }
34
+ interface BitbucketCodeSearchLine {
35
+ line: number;
36
+ segments: BitbucketCodeSearchSegment[];
37
+ }
38
+ interface BitbucketCodeSearchContentMatch {
39
+ lines: BitbucketCodeSearchLine[];
40
+ }
41
+ export interface BitbucketCodeSearchItem {
42
+ type: string;
43
+ content_matches: BitbucketCodeSearchContentMatch[];
44
+ path_matches?: BitbucketCodeSearchContentMatch[];
45
+ file: {
46
+ path: string;
47
+ type: string;
48
+ links?: {
49
+ self?: {
50
+ href: string;
51
+ };
52
+ };
53
+ };
54
+ }
55
+ export interface BitbucketCodeSearchResult {
56
+ items: BitbucketCodeSearchItem[];
57
+ totalCount: number;
58
+ pagination: {
59
+ currentPage: number;
60
+ totalPages: number;
61
+ hasMore: boolean;
62
+ totalMatches?: number;
63
+ };
64
+ }
65
+ export interface BitbucketRepository {
66
+ uuid: string;
67
+ name: string;
68
+ full_name: string;
69
+ slug: string;
70
+ description: string;
71
+ is_private: boolean;
72
+ language: string;
73
+ mainbranch?: {
74
+ name: string;
75
+ type: string;
76
+ };
77
+ updated_on: string;
78
+ created_on: string;
79
+ size?: number;
80
+ forks_count?: number;
81
+ has_issues?: boolean;
82
+ has_wiki?: boolean;
83
+ links?: {
84
+ html?: {
85
+ href: string;
86
+ };
87
+ clone?: Array<{
88
+ href: string;
89
+ name: string;
90
+ }>;
91
+ };
92
+ project?: {
93
+ key: string;
94
+ name: string;
95
+ };
96
+ owner?: {
97
+ display_name: string;
98
+ username?: string;
99
+ uuid: string;
100
+ };
101
+ }
102
+ export interface BitbucketFileContentResult {
103
+ content: string;
104
+ path: string;
105
+ size: number;
106
+ ref: string;
107
+ encoding: 'utf-8';
108
+ lastCommitSha?: string;
109
+ }
110
+ export interface BitbucketTreeEntry {
111
+ type: 'commit_file' | 'commit_directory';
112
+ path: string;
113
+ size?: number;
114
+ commit?: {
115
+ hash: string;
116
+ };
117
+ links?: {
118
+ self?: {
119
+ href: string;
120
+ };
121
+ };
122
+ }
123
+ export interface BitbucketPullRequest {
124
+ id: number;
125
+ title: string;
126
+ description: string;
127
+ state: 'OPEN' | 'MERGED' | 'DECLINED' | 'SUPERSEDED';
128
+ author: {
129
+ display_name: string;
130
+ username?: string;
131
+ uuid: string;
132
+ };
133
+ source: {
134
+ branch: {
135
+ name: string;
136
+ };
137
+ commit?: {
138
+ hash: string;
139
+ };
140
+ repository?: {
141
+ full_name: string;
142
+ };
143
+ };
144
+ destination: {
145
+ branch: {
146
+ name: string;
147
+ };
148
+ commit?: {
149
+ hash: string;
150
+ };
151
+ repository?: {
152
+ full_name: string;
153
+ };
154
+ };
155
+ close_source_branch?: boolean;
156
+ created_on: string;
157
+ updated_on: string;
158
+ comment_count?: number;
159
+ task_count?: number;
160
+ merge_commit?: {
161
+ hash: string;
162
+ };
163
+ closed_by?: {
164
+ display_name: string;
165
+ };
166
+ links?: {
167
+ html?: {
168
+ href: string;
169
+ };
170
+ diff?: {
171
+ href: string;
172
+ };
173
+ diffstat?: {
174
+ href: string;
175
+ };
176
+ comments?: {
177
+ href: string;
178
+ };
179
+ commits?: {
180
+ href: string;
181
+ };
182
+ };
183
+ reviewers?: Array<{
184
+ display_name: string;
185
+ username?: string;
186
+ uuid: string;
187
+ }>;
188
+ }
189
+ export interface BitbucketPRComment {
190
+ id: number;
191
+ content: {
192
+ raw: string;
193
+ markup?: string;
194
+ html?: string;
195
+ };
196
+ user: {
197
+ display_name: string;
198
+ username?: string;
199
+ };
200
+ created_on: string;
201
+ updated_on: string;
202
+ inline?: {
203
+ from?: number;
204
+ to?: number;
205
+ path: string;
206
+ };
207
+ }
208
+ export interface BitbucketDiffstatEntry {
209
+ type: string;
210
+ status: 'added' | 'removed' | 'modified' | 'renamed';
211
+ old?: {
212
+ path: string;
213
+ };
214
+ new?: {
215
+ path: string;
216
+ };
217
+ lines_added: number;
218
+ lines_removed: number;
219
+ }
220
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { BitbucketConfig, BitbucketTokenSourceType } from './types.js';
2
+ export declare function getBitbucketConfig(): BitbucketConfig;
3
+ export declare function getBitbucketToken(): string | null;
4
+ /**
5
+ * Get the Bitbucket host URL.
6
+ * Priority: env var > config file > default
7
+ */
8
+ export declare function getBitbucketHost(): string;
9
+ export declare function getBitbucketUsername(): string | null;
10
+ export declare function getBitbucketTokenSource(): BitbucketTokenSourceType;
11
+ export declare function isBitbucketConfigured(): boolean;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Base command builder class for constructing safe shell commands
3
+ */
4
+ /**
5
+ * Abstract base class for building command strings safely
6
+ */
7
+ export declare abstract class BaseCommandBuilder {
8
+ protected command: string;
9
+ protected args: string[];
10
+ constructor(command: string);
11
+ /**
12
+ * Adds a flag (e.g., -r, -i)
13
+ */
14
+ addFlag(flag: string): this;
15
+ /**
16
+ * Adds an option with a value (e.g., -A 3)
17
+ */
18
+ protected addOption(option: string, value: string | number): this;
19
+ /**
20
+ * Adds a raw argument (will be validated but not escaped)
21
+ * Note: escaping is not needed when using spawn() which passes args directly
22
+ */
23
+ protected addArg(arg: string): this;
24
+ /**
25
+ * Builds the final command arguments array
26
+ */
27
+ build(): {
28
+ command: string;
29
+ args: string[];
30
+ };
31
+ /**
32
+ * Resets the builder to initial state
33
+ */
34
+ reset(): this;
35
+ /**
36
+ * Gets the current args (for debugging)
37
+ */
38
+ getArgs(): string[];
39
+ }
@@ -0,0 +1,73 @@
1
+ import { BaseCommandBuilder } from './BaseCommandBuilder.js';
2
+ import type { FindFilesQuery } from '@octocodeai/octocode-core';
3
+ export declare class FindCommandBuilder extends BaseCommandBuilder {
4
+ private isMacOS;
5
+ private isLinux;
6
+ private isWindows;
7
+ constructor();
8
+ fromQuery(query: FindFilesQuery): this;
9
+ /**
10
+ * Builds the excludeDir prune block:
11
+ * ( -path "*\/dir" -o -path "*\/dir/*" ) -prune
12
+ * Repeated for each directory
13
+ */
14
+ private buildExcludeDirPrune;
15
+ /**
16
+ * Adds all filter options (type, names, size, time, etc.)
17
+ * These must come AFTER the prune block when excludeDir is used
18
+ */
19
+ private addFilters;
20
+ simple(path: string, name: string): this;
21
+ type(type: 'f' | 'd' | 'l'): this;
22
+ name(pattern: string): this;
23
+ iname(pattern: string): this;
24
+ maxDepth(depth: number): this;
25
+ minDepth(depth: number): this;
26
+ size(size: string): this;
27
+ mtime(time: string): this;
28
+ path(path: string): this;
29
+ /**
30
+ * Ensures regex patterns match against the full path.
31
+ *
32
+ * `find -regex` matches against the ENTIRE path (e.g. /Users/.../foo.test.ts),
33
+ * not just the filename. Users commonly provide filename-oriented patterns like
34
+ * `\.(test|spec)\.ts$` which silently return 0 results.
35
+ *
36
+ * This method prepends `.*` when the pattern doesn't already account for the
37
+ * full path, so `\.(test|spec)\.ts$` becomes `.*\.(test|spec)\.ts$` and works.
38
+ *
39
+ * Patterns that already start with `.*`, `/`, or `^` are left unchanged.
40
+ */
41
+ private normalizeRegexForFullPath;
42
+ /**
43
+ * Parses time string and returns appropriate find flag
44
+ * Hours use -mmin (minutes), days/weeks/months use -mtime (days)
45
+ */
46
+ private parseTimeString;
47
+ /**
48
+ * Parses access time string (similar to mtime but uses -atime/-amin)
49
+ */
50
+ private parseTimeStringAccess;
51
+ /**
52
+ * Normalizes size suffix for cross-platform compatibility.
53
+ *
54
+ * PLATFORM DIFFERENCES:
55
+ * - macOS BSD find: Only supports 'c' (bytes) and 'k' (kilobytes) - LOWERCASE ONLY
56
+ * - Linux GNU find: Supports 'c', 'w', 'b', 'k', 'K', 'M', 'G' (case-sensitive)
57
+ *
58
+ * BUG FIX HISTORY:
59
+ * Before: Users passing "10K" would get "find: -size: +10K: illegal trailing character" on macOS
60
+ * After: "10K" is normalized to "10k", works on both macOS and Linux
61
+ *
62
+ * EXAMPLES:
63
+ * - "10K" → "10k" (kilobytes, normalized for macOS)
64
+ * - "10k" → "10k" (already lowercase)
65
+ * - "100" → "100" (bytes, no suffix)
66
+ * - "1M" → "1048576c" (megabytes converted to bytes for macOS compatibility)
67
+ * - "1G" → "1073741824c" (gigabytes converted to bytes for macOS compatibility)
68
+ *
69
+ * @param size - Size string like "10k", "10K", "1M", "1G", or raw number
70
+ * @returns Normalized size string compatible with both macOS and Linux
71
+ */
72
+ private normalizeSizeForPlatform;
73
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Command builder for grep (fallback when ripgrep is not available)
3
+ * Maps RipgrepQuery parameters to grep equivalents where possible
4
+ */
5
+ import { BaseCommandBuilder } from './BaseCommandBuilder.js';
6
+ import type { RipgrepQuery } from '@octocodeai/octocode-core';
7
+ /**
8
+ * Features not supported by grep (will generate warnings)
9
+ */
10
+ interface GrepUnsupportedFeatures {
11
+ smartCase: boolean;
12
+ multiline: boolean;
13
+ countMatches: boolean;
14
+ jsonOutput: boolean;
15
+ sortOptions: boolean;
16
+ threads: boolean;
17
+ mmap: boolean;
18
+ stats: boolean;
19
+ gitignore: boolean;
20
+ }
21
+ /**
22
+ * Check which features are unsupported when using grep
23
+ */
24
+ export declare function getUnsupportedGrepFeatures(query: RipgrepQuery): GrepUnsupportedFeatures;
25
+ /**
26
+ * Generate warnings for unsupported grep features
27
+ */
28
+ export declare function getGrepFeatureWarnings(query: RipgrepQuery): string[];
29
+ export declare class GrepCommandBuilder extends BaseCommandBuilder {
30
+ constructor();
31
+ /**
32
+ * Simple convenience method to set pattern and path with default flags
33
+ */
34
+ simple(pattern: string, path: string): this;
35
+ /**
36
+ * Enable case-insensitive search
37
+ */
38
+ caseInsensitive(): this;
39
+ /**
40
+ * Only show filenames with matches
41
+ */
42
+ filesOnly(): this;
43
+ /**
44
+ * Show context lines around matches
45
+ */
46
+ context(lines: number): this;
47
+ /**
48
+ * Include only files matching pattern
49
+ */
50
+ include(pattern: string): this;
51
+ /**
52
+ * Exclude files matching pattern
53
+ */
54
+ exclude(pattern: string): this;
55
+ /**
56
+ * Exclude directory from search
57
+ */
58
+ excludeDir(dir: string): this;
59
+ /**
60
+ * Treat pattern as fixed string (not regex)
61
+ */
62
+ fixedString(): this;
63
+ /**
64
+ * Build grep command from RipgrepQuery
65
+ * Maps compatible options and ignores unsupported ones
66
+ */
67
+ fromQuery(query: RipgrepQuery): this;
68
+ }
69
+ export {};
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Ls command builder for directory listing
3
+ */
4
+ import { BaseCommandBuilder } from './BaseCommandBuilder.js';
5
+ import type { ViewStructureQuery } from '@octocodeai/octocode-core';
6
+ /**
7
+ * Builder for ls commands
8
+ */
9
+ export declare class LsCommandBuilder extends BaseCommandBuilder {
10
+ constructor();
11
+ /**
12
+ * Builds an ls command from a view structure query
13
+ */
14
+ fromQuery(query: ViewStructureQuery): this;
15
+ /**
16
+ * Simple directory listing
17
+ */
18
+ simple(path: string): this;
19
+ /**
20
+ * Detailed listing with long format
21
+ */
22
+ detailed(): this;
23
+ /**
24
+ * Show hidden files
25
+ */
26
+ all(): this;
27
+ /**
28
+ * Human-readable file sizes
29
+ */
30
+ humanReadable(): this;
31
+ /**
32
+ * Recursive listing
33
+ */
34
+ recursive(): this;
35
+ /**
36
+ * Sort by size
37
+ */
38
+ sortBySize(): this;
39
+ /**
40
+ * Sort by time
41
+ */
42
+ sortByTime(): this;
43
+ /**
44
+ * Reverse sort order
45
+ */
46
+ reverse(): this;
47
+ /**
48
+ * Set the path to list
49
+ */
50
+ path(path: string): this;
51
+ }