@morphllm/morphsdk 0.2.122 → 0.2.124

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 (176) hide show
  1. package/dist/{chunk-T3T4LGRD.js → chunk-27BLOUAR.js} +27 -3
  2. package/dist/chunk-27BLOUAR.js.map +1 -0
  3. package/dist/{chunk-2MJEULZU.js → chunk-34UAUD5I.js} +2 -2
  4. package/dist/{chunk-OTGBQEVH.js → chunk-3ZO2UAYM.js} +2 -2
  5. package/dist/{chunk-L4URLBKV.js → chunk-A2OVRHEW.js} +3 -3
  6. package/dist/{chunk-7KOUCN6T.js → chunk-BFJAFWMR.js} +2 -2
  7. package/dist/{chunk-5UUJULLM.js → chunk-DUJ32DHI.js} +2 -2
  8. package/dist/{chunk-73GZ6KUK.js → chunk-EIJAUTHH.js} +2 -2
  9. package/dist/{chunk-OWISPSLH.js → chunk-F7VTQZH7.js} +2 -2
  10. package/dist/{chunk-WYYR2EU6.js → chunk-GVGJIXV2.js} +7 -2
  11. package/dist/chunk-GVGJIXV2.js.map +1 -0
  12. package/dist/{chunk-MQWEZJTP.js → chunk-HHRHUUGN.js} +5 -5
  13. package/dist/chunk-HHRHUUGN.js.map +1 -0
  14. package/dist/{chunk-TBLMIAIH.js → chunk-ICLIJKYL.js} +25 -3
  15. package/dist/chunk-ICLIJKYL.js.map +1 -0
  16. package/dist/{chunk-4GEBF5OH.js → chunk-KAI2DLL5.js} +2 -2
  17. package/dist/{chunk-GTANVDUZ.js → chunk-KQRX2K2W.js} +2 -2
  18. package/dist/{chunk-4LA3OT4Q.js → chunk-M6VWLSL4.js} +25 -4
  19. package/dist/chunk-M6VWLSL4.js.map +1 -0
  20. package/dist/{chunk-EBROW6GK.js → chunk-N6YX3M4I.js} +2 -2
  21. package/dist/chunk-OTOVGCG6.js +42 -0
  22. package/dist/chunk-OTOVGCG6.js.map +1 -0
  23. package/dist/{chunk-TXT3W4QK.js → chunk-S4RLT56A.js} +81 -3
  24. package/dist/chunk-S4RLT56A.js.map +1 -0
  25. package/dist/{chunk-RNKHRNSG.js → chunk-SGRNIWJD.js} +2 -2
  26. package/dist/{chunk-RNKHRNSG.js.map → chunk-SGRNIWJD.js.map} +1 -1
  27. package/dist/{chunk-QGE7FGGT.js → chunk-STPK3AAF.js} +2 -2
  28. package/dist/{chunk-64KNVHR4.js → chunk-V3HLOZK2.js} +1 -1
  29. package/dist/{chunk-64KNVHR4.js.map → chunk-V3HLOZK2.js.map} +1 -1
  30. package/dist/{chunk-LE24SVVU.js → chunk-VKQLHW6G.js} +2 -2
  31. package/dist/{chunk-3PMFQ5AV.js → chunk-W4PYHVIJ.js} +2 -2
  32. package/dist/{chunk-2AQLRL4U.js → chunk-WG5E7MMA.js} +2 -2
  33. package/dist/{chunk-4IU2K63O.js → chunk-Z7U7ZRMP.js} +2 -2
  34. package/dist/{chunk-ZHRT6F72.js → chunk-ZD5PEXNS.js} +1 -1
  35. package/dist/{chunk-UDGJQBTC.js → chunk-ZVVCJGNL.js} +15 -15
  36. package/dist/{client-BJrzbMYL.d.ts → client-JHPwle1Z.d.ts} +1 -1
  37. package/dist/client.cjs +84 -9
  38. package/dist/client.cjs.map +1 -1
  39. package/dist/client.d.ts +2 -2
  40. package/dist/client.js +22 -22
  41. package/dist/edge.cjs +1 -1
  42. package/dist/edge.cjs.map +1 -1
  43. package/dist/edge.js +4 -4
  44. package/dist/index.cjs +84 -9
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.d.ts +2 -2
  47. package/dist/index.js +23 -23
  48. package/dist/modelrouter/core.cjs +1 -1
  49. package/dist/modelrouter/core.cjs.map +1 -1
  50. package/dist/modelrouter/core.js +3 -3
  51. package/dist/modelrouter/index.cjs +1 -1
  52. package/dist/modelrouter/index.cjs.map +1 -1
  53. package/dist/modelrouter/index.js +3 -3
  54. package/dist/tools/browser/anthropic.cjs +1 -1
  55. package/dist/tools/browser/anthropic.cjs.map +1 -1
  56. package/dist/tools/browser/anthropic.js +5 -5
  57. package/dist/tools/browser/core.cjs +1 -1
  58. package/dist/tools/browser/core.cjs.map +1 -1
  59. package/dist/tools/browser/core.js +4 -4
  60. package/dist/tools/browser/index.cjs +1 -1
  61. package/dist/tools/browser/index.cjs.map +1 -1
  62. package/dist/tools/browser/index.js +7 -7
  63. package/dist/tools/browser/openai.cjs +1 -1
  64. package/dist/tools/browser/openai.cjs.map +1 -1
  65. package/dist/tools/browser/openai.js +5 -5
  66. package/dist/tools/browser/profiles/core.cjs +1 -1
  67. package/dist/tools/browser/profiles/core.cjs.map +1 -1
  68. package/dist/tools/browser/profiles/core.js +3 -3
  69. package/dist/tools/browser/profiles/index.cjs +1 -1
  70. package/dist/tools/browser/profiles/index.cjs.map +1 -1
  71. package/dist/tools/browser/profiles/index.js +3 -3
  72. package/dist/tools/browser/vercel.cjs +1 -1
  73. package/dist/tools/browser/vercel.cjs.map +1 -1
  74. package/dist/tools/browser/vercel.js +5 -5
  75. package/dist/tools/codebase_search/anthropic.cjs +1 -1
  76. package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
  77. package/dist/tools/codebase_search/anthropic.js +4 -4
  78. package/dist/tools/codebase_search/core.cjs +1 -1
  79. package/dist/tools/codebase_search/core.cjs.map +1 -1
  80. package/dist/tools/codebase_search/core.js +3 -3
  81. package/dist/tools/codebase_search/index.cjs +1 -1
  82. package/dist/tools/codebase_search/index.cjs.map +1 -1
  83. package/dist/tools/codebase_search/index.js +6 -6
  84. package/dist/tools/codebase_search/openai.cjs +1 -1
  85. package/dist/tools/codebase_search/openai.cjs.map +1 -1
  86. package/dist/tools/codebase_search/openai.js +4 -4
  87. package/dist/tools/codebase_search/vercel.cjs +1 -1
  88. package/dist/tools/codebase_search/vercel.cjs.map +1 -1
  89. package/dist/tools/codebase_search/vercel.js +4 -4
  90. package/dist/tools/fastapply/anthropic.cjs +1 -1
  91. package/dist/tools/fastapply/anthropic.cjs.map +1 -1
  92. package/dist/tools/fastapply/anthropic.js +4 -4
  93. package/dist/tools/fastapply/apply.cjs +1 -1
  94. package/dist/tools/fastapply/apply.cjs.map +1 -1
  95. package/dist/tools/fastapply/apply.js +2 -2
  96. package/dist/tools/fastapply/core.cjs +1 -1
  97. package/dist/tools/fastapply/core.cjs.map +1 -1
  98. package/dist/tools/fastapply/core.js +3 -3
  99. package/dist/tools/fastapply/index.cjs +1 -1
  100. package/dist/tools/fastapply/index.cjs.map +1 -1
  101. package/dist/tools/fastapply/index.js +6 -6
  102. package/dist/tools/fastapply/openai.cjs +1 -1
  103. package/dist/tools/fastapply/openai.cjs.map +1 -1
  104. package/dist/tools/fastapply/openai.js +4 -4
  105. package/dist/tools/fastapply/vercel.cjs +1 -1
  106. package/dist/tools/fastapply/vercel.cjs.map +1 -1
  107. package/dist/tools/fastapply/vercel.js +4 -4
  108. package/dist/tools/index.cjs +1 -1
  109. package/dist/tools/index.cjs.map +1 -1
  110. package/dist/tools/index.js +6 -6
  111. package/dist/tools/utils/resilience.cjs +1 -1
  112. package/dist/tools/utils/resilience.cjs.map +1 -1
  113. package/dist/tools/utils/resilience.js +2 -2
  114. package/dist/tools/warp_grep/agent/runner.cjs +4 -4
  115. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  116. package/dist/tools/warp_grep/agent/runner.js +2 -2
  117. package/dist/tools/warp_grep/anthropic.cjs +123 -9
  118. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  119. package/dist/tools/warp_grep/anthropic.d.ts +29 -2
  120. package/dist/tools/warp_grep/anthropic.js +8 -6
  121. package/dist/tools/warp_grep/client.cjs +90 -5
  122. package/dist/tools/warp_grep/client.cjs.map +1 -1
  123. package/dist/tools/warp_grep/client.d.ts +27 -2
  124. package/dist/tools/warp_grep/client.js +8 -4
  125. package/dist/tools/warp_grep/gemini.cjs +120 -7
  126. package/dist/tools/warp_grep/gemini.cjs.map +1 -1
  127. package/dist/tools/warp_grep/gemini.d.ts +29 -2
  128. package/dist/tools/warp_grep/gemini.js +36 -5
  129. package/dist/tools/warp_grep/gemini.js.map +1 -1
  130. package/dist/tools/warp_grep/index.cjs +116 -9
  131. package/dist/tools/warp_grep/index.cjs.map +1 -1
  132. package/dist/tools/warp_grep/index.d.ts +32 -4
  133. package/dist/tools/warp_grep/index.js +16 -6
  134. package/dist/tools/warp_grep/openai.cjs +126 -9
  135. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  136. package/dist/tools/warp_grep/openai.d.ts +29 -2
  137. package/dist/tools/warp_grep/openai.js +8 -6
  138. package/dist/tools/warp_grep/providers/code_storage_http.cjs +6 -1
  139. package/dist/tools/warp_grep/providers/code_storage_http.cjs.map +1 -1
  140. package/dist/tools/warp_grep/providers/code_storage_http.d.ts +1 -1
  141. package/dist/tools/warp_grep/providers/code_storage_http.js +1 -1
  142. package/dist/tools/warp_grep/providers/remote.d.ts +1 -1
  143. package/dist/tools/warp_grep/vercel.cjs +101 -6
  144. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  145. package/dist/tools/warp_grep/vercel.d.ts +30 -2
  146. package/dist/tools/warp_grep/vercel.js +8 -6
  147. package/dist/{types-CA7989hK.d.ts → types-DY_hq2eZ.d.ts} +37 -1
  148. package/dist/version.cjs +1 -1
  149. package/dist/version.cjs.map +1 -1
  150. package/dist/version.js +1 -1
  151. package/package.json +1 -1
  152. package/dist/chunk-4LA3OT4Q.js.map +0 -1
  153. package/dist/chunk-KJZMKDDP.js +0 -23
  154. package/dist/chunk-KJZMKDDP.js.map +0 -1
  155. package/dist/chunk-MQWEZJTP.js.map +0 -1
  156. package/dist/chunk-T3T4LGRD.js.map +0 -1
  157. package/dist/chunk-TBLMIAIH.js.map +0 -1
  158. package/dist/chunk-TXT3W4QK.js.map +0 -1
  159. package/dist/chunk-WYYR2EU6.js.map +0 -1
  160. /package/dist/{chunk-2MJEULZU.js.map → chunk-34UAUD5I.js.map} +0 -0
  161. /package/dist/{chunk-OTGBQEVH.js.map → chunk-3ZO2UAYM.js.map} +0 -0
  162. /package/dist/{chunk-L4URLBKV.js.map → chunk-A2OVRHEW.js.map} +0 -0
  163. /package/dist/{chunk-7KOUCN6T.js.map → chunk-BFJAFWMR.js.map} +0 -0
  164. /package/dist/{chunk-5UUJULLM.js.map → chunk-DUJ32DHI.js.map} +0 -0
  165. /package/dist/{chunk-73GZ6KUK.js.map → chunk-EIJAUTHH.js.map} +0 -0
  166. /package/dist/{chunk-OWISPSLH.js.map → chunk-F7VTQZH7.js.map} +0 -0
  167. /package/dist/{chunk-4GEBF5OH.js.map → chunk-KAI2DLL5.js.map} +0 -0
  168. /package/dist/{chunk-GTANVDUZ.js.map → chunk-KQRX2K2W.js.map} +0 -0
  169. /package/dist/{chunk-EBROW6GK.js.map → chunk-N6YX3M4I.js.map} +0 -0
  170. /package/dist/{chunk-QGE7FGGT.js.map → chunk-STPK3AAF.js.map} +0 -0
  171. /package/dist/{chunk-LE24SVVU.js.map → chunk-VKQLHW6G.js.map} +0 -0
  172. /package/dist/{chunk-3PMFQ5AV.js.map → chunk-W4PYHVIJ.js.map} +0 -0
  173. /package/dist/{chunk-2AQLRL4U.js.map → chunk-WG5E7MMA.js.map} +0 -0
  174. /package/dist/{chunk-4IU2K63O.js.map → chunk-Z7U7ZRMP.js.map} +0 -0
  175. /package/dist/{chunk-ZHRT6F72.js.map → chunk-ZD5PEXNS.js.map} +0 -0
  176. /package/dist/{chunk-UDGJQBTC.js.map → chunk-ZVVCJGNL.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { WarpGrepStep } from './agent/types.js';
2
- import { W as WarpGrepClientConfig, a as WarpGrepInput, b as WarpGrepResult, G as GitHubSearchInput, d as WarpGrepToolConfig } from '../../types-CA7989hK.js';
2
+ import { W as WarpGrepClientConfig, a as WarpGrepInput, b as WarpGrepResult, G as GitHubSearchInput, e as GitHubReadFileInput, f as GitHubReadFileResult, d as WarpGrepToolConfig } from '../../types-DY_hq2eZ.js';
3
3
  import '../utils/resilience.js';
4
4
  import './providers/types.js';
5
5
 
@@ -100,6 +100,21 @@ declare class WarpGrepClient {
100
100
  searchGitHub(input: GitHubSearchInput & {
101
101
  streamSteps?: false | undefined;
102
102
  }): Promise<WarpGrepResult>;
103
+ /**
104
+ * Read a single file from a public GitHub repository
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * const result = await client.readGitHubFile({
109
+ * github: 'vercel/next.js',
110
+ * path: 'src/server/app-render/index.tsx',
111
+ * startLine: 1,
112
+ * endLine: 50,
113
+ * });
114
+ * if (result.success) console.log(result.content);
115
+ * ```
116
+ */
117
+ readGitHubFile(input: GitHubReadFileInput): Promise<GitHubReadFileResult>;
103
118
  private _resolveGitHubRepo;
104
119
  private _searchGitHubAsync;
105
120
  private _searchGitHubStreaming;
@@ -146,6 +161,16 @@ declare function executeToolCall(input: {
146
161
  declare function executeToolCallStreaming(input: {
147
162
  query: string;
148
163
  } | string, config: WarpGrepToolConfig): AsyncGenerator<WarpGrepStep, WarpGrepResult, undefined>;
164
+ /**
165
+ * Read a single file (or line range) from a public GitHub repository
166
+ */
167
+ declare function executeGitHubReadFile(input: GitHubReadFileInput, config?: {
168
+ timeout?: number;
169
+ }): Promise<GitHubReadFileResult>;
170
+ /**
171
+ * Format a GitHub read file result for display or tool responses
172
+ */
173
+ declare function formatGitHubReadFileResult(result: GitHubReadFileResult): string;
149
174
  /**
150
175
  * Format warp grep results for display or tool responses
151
176
  *
@@ -154,4 +179,4 @@ declare function executeToolCallStreaming(input: {
154
179
  */
155
180
  declare function formatResult(result: WarpGrepResult): string;
156
181
 
157
- export { WarpGrepClient, executeToolCall, executeToolCallStreaming, executeWarpGrep, formatResult };
182
+ export { WarpGrepClient, executeGitHubReadFile, executeToolCall, executeToolCallStreaming, executeWarpGrep, formatGitHubReadFileResult, formatResult };
@@ -1,26 +1,30 @@
1
1
  import {
2
2
  WarpGrepClient,
3
+ executeGitHubReadFile,
3
4
  executeToolCall,
4
5
  executeToolCallStreaming,
5
6
  executeWarpGrep,
7
+ formatGitHubReadFileResult,
6
8
  formatResult
7
- } from "../../chunk-TXT3W4QK.js";
8
- import "../../chunk-WYYR2EU6.js";
9
+ } from "../../chunk-S4RLT56A.js";
10
+ import "../../chunk-GVGJIXV2.js";
9
11
  import "../../chunk-PUGSTXLO.js";
10
12
  import "../../chunk-63VHBANJ.js";
11
- import "../../chunk-MQWEZJTP.js";
13
+ import "../../chunk-HHRHUUGN.js";
12
14
  import "../../chunk-3MLWXJTJ.js";
13
15
  import "../../chunk-5PNMAWLC.js";
14
16
  import "../../chunk-APP75CBN.js";
15
17
  import "../../chunk-GHGJAQSJ.js";
16
18
  import "../../chunk-FMLHRJDF.js";
17
- import "../../chunk-RNKHRNSG.js";
19
+ import "../../chunk-SGRNIWJD.js";
18
20
  import "../../chunk-PZ5AY32C.js";
19
21
  export {
20
22
  WarpGrepClient,
23
+ executeGitHubReadFile,
21
24
  executeToolCall,
22
25
  executeToolCallStreaming,
23
26
  executeWarpGrep,
27
+ formatGitHubReadFileResult,
24
28
  formatResult
25
29
  };
26
30
  //# sourceMappingURL=client.js.map
@@ -572,6 +572,7 @@ Details: ${res.stderr}` : ""}`
572
572
  // tools/warp_grep/gemini.ts
573
573
  var gemini_exports = {};
574
574
  __export(gemini_exports, {
575
+ createGitHubReadFileTool: () => createGitHubReadFileTool,
575
576
  createGitHubSearchTool: () => createGitHubSearchTool,
576
577
  createMorphWarpGrepTool: () => createMorphWarpGrepTool,
577
578
  createWarpGrepTool: () => createWarpGrepTool,
@@ -1380,7 +1381,7 @@ var import_openai = __toESM(require("openai"), 1);
1380
1381
  // package.json
1381
1382
  var package_default = {
1382
1383
  name: "@morphllm/morphsdk",
1383
- version: "0.2.122",
1384
+ version: "0.2.124",
1384
1385
  description: "TypeScript SDK and CLI for Morph Fast Apply integration",
1385
1386
  type: "module",
1386
1387
  main: "./dist/index.cjs",
@@ -1630,9 +1631,9 @@ async function callModel(messages, model, options = {}) {
1630
1631
  });
1631
1632
  } catch (error) {
1632
1633
  if (error instanceof import_openai.default.APIError && error.status === 404) {
1633
- throw new Error(
1634
- "The endpoint you are trying to call is likely deprecated. Please update with: npm cache clean --force && npx -y @morphllm/morphmcp@latest or visit: https://morphllm.com/mcp"
1635
- );
1634
+ const defaultMsg = "The endpoint you are trying to call is likely deprecated. Please update with: npm cache clean --force && npx -y @morphllm/morphmcp@latest or visit: https://morphllm.com/mcp";
1635
+ const errorText = error.message?.trim();
1636
+ throw new Error(errorText || defaultMsg);
1636
1637
  }
1637
1638
  throw error;
1638
1639
  }
@@ -2169,7 +2170,12 @@ async function post(url, body, op) {
2169
2170
  });
2170
2171
  if (!res.ok) {
2171
2172
  const text = await res.text().catch(() => res.statusText);
2172
- throw new Error(`${op} failed (${res.status}): ${text}`);
2173
+ try {
2174
+ const parsed = JSON.parse(text);
2175
+ if (parsed.error) return `Error: ${parsed.error}`;
2176
+ } catch {
2177
+ }
2178
+ return `Error: ${op} failed (${res.status}): ${text}`;
2173
2179
  }
2174
2180
  const data = await res.json();
2175
2181
  if (data.error) throw new Error(data.error);
@@ -2238,6 +2244,23 @@ var WarpGrepClient = class {
2238
2244
  }
2239
2245
  return this._searchGitHubAsync(input);
2240
2246
  }
2247
+ /**
2248
+ * Read a single file from a public GitHub repository
2249
+ *
2250
+ * @example
2251
+ * ```typescript
2252
+ * const result = await client.readGitHubFile({
2253
+ * github: 'vercel/next.js',
2254
+ * path: 'src/server/app-render/index.tsx',
2255
+ * startLine: 1,
2256
+ * endLine: 50,
2257
+ * });
2258
+ * if (result.success) console.log(result.content);
2259
+ * ```
2260
+ */
2261
+ async readGitHubFile(input) {
2262
+ return executeGitHubReadFile(input, { timeout: this.config.timeout });
2263
+ }
2241
2264
  async _resolveGitHubRepo(input) {
2242
2265
  const { owner, repo } = parseGitHubUrl(input.github);
2243
2266
  const baseUrl = this.config.codeSearchUrl || DEFAULT_CODE_SEARCH_URL;
@@ -2358,6 +2381,65 @@ async function* executeToolCallStreaming(input, config) {
2358
2381
  }
2359
2382
  return processAgentResult(agentResult);
2360
2383
  }
2384
+ async function fetchRawGitHubFile(owner, repo, filePath, branch, timeout) {
2385
+ const branches = branch ? [branch] : ["HEAD"];
2386
+ const fallbacks = ["main", "master", "develop"];
2387
+ const fetchWithTimeout = (url) => timeout ? fetch(url, { signal: AbortSignal.timeout(timeout) }) : fetch(url);
2388
+ for (const b of branches) {
2389
+ const url = `https://raw.githubusercontent.com/${owner}/${repo}/${b}/${filePath}`;
2390
+ const res = await fetchWithTimeout(url);
2391
+ if (res.ok) return { content: await res.text(), branch: b };
2392
+ }
2393
+ for (const fb of fallbacks) {
2394
+ if (branch && fb === branch) continue;
2395
+ const url = `https://raw.githubusercontent.com/${owner}/${repo}/${fb}/${filePath}`;
2396
+ const res = await fetchWithTimeout(url);
2397
+ if (res.ok) return { content: await res.text(), branch: fb };
2398
+ }
2399
+ throw new Error(`File not found: ${owner}/${repo}/${filePath}`);
2400
+ }
2401
+ async function executeGitHubReadFile(input, config) {
2402
+ try {
2403
+ const { owner, repo } = parseGitHubUrl(input.github);
2404
+ const { content: raw, branch } = await fetchRawGitHubFile(
2405
+ owner,
2406
+ repo,
2407
+ input.path,
2408
+ input.branch,
2409
+ config?.timeout
2410
+ );
2411
+ const allLines = raw.split("\n");
2412
+ const totalLines = allLines.length;
2413
+ const start = Math.max(1, input.startLine ?? 1);
2414
+ const end = Math.min(totalLines, input.endLine ?? totalLines);
2415
+ const selected = allLines.slice(start - 1, end);
2416
+ const padWidth = String(end).length;
2417
+ const numbered = selected.map((line, i) => `${String(start + i).padStart(padWidth)}|${line}`).join("\n");
2418
+ return {
2419
+ success: true,
2420
+ content: numbered,
2421
+ path: input.path,
2422
+ github: `${owner}/${repo}`,
2423
+ branch,
2424
+ lineRange: [start, end],
2425
+ totalLines
2426
+ };
2427
+ } catch (error) {
2428
+ return {
2429
+ success: false,
2430
+ error: error instanceof Error ? error.message : String(error)
2431
+ };
2432
+ }
2433
+ }
2434
+ function formatGitHubReadFileResult(result) {
2435
+ if (!result.success) {
2436
+ return `Failed to read file: ${result.error}`;
2437
+ }
2438
+ const rangeStr = result.lineRange ? ` (lines ${result.lineRange[0]}-${result.lineRange[1]} of ${result.totalLines})` : "";
2439
+ return `File: ${result.github}/${result.path}${rangeStr}
2440
+
2441
+ ${result.content}`;
2442
+ }
2361
2443
  function formatResult(result) {
2362
2444
  if (!result.success) {
2363
2445
  return `Search failed: ${result.error}`;
@@ -2386,8 +2468,12 @@ function formatResult(result) {
2386
2468
  // tools/warp_grep/prompts.ts
2387
2469
  var WARP_GREP_TOOL_NAME = "warpgrep_codebase_search";
2388
2470
  var WARP_GREP_DESCRIPTION = 'IMPORTANT: If you need to explore the codebase to gather context, and the task does not involve a single file or function which is provided by name, you should ALWAYS use the warpgrep codebase search tool first instead of running search commands. When the task requires exploration beyond a single known file, invoke warpgrep first with a natural-language query describing the target functionality, bug, or architectural concern. Warp Grep is a fast and accurate tool that can search for all relevant context in a codebase. Keep queries action-oriented (e.g., "Find where billing invoices are generated and emailed"), and after reviewing the summarized results, you may verify important findings with other search tools or direct file reads to ensure completeness. Warp Grep can be used for query types like: find function responsible for <small feature>; find code that does <description>; find code path for <big feature>; Where does <minimal error message> come from?; or any query of that type. When a task requires exploration beyond a single known file, ALWAYS default to warpgrep codebase search before other search mechanisms.';
2389
- var GITHUB_SEARCH_TOOL_NAME = "warpgrep_github_search";
2390
- var GITHUB_SEARCH_DESCRIPTION = "Search a public GitHub repository using WarpGrep. Provide a GitHub URL or owner/repo shorthand and a natural language query.";
2471
+ var GITHUB_WARP_GREP_SEARCH_TOOL_NAME = "warpgrep_github_search";
2472
+ var GITHUB_WARP_GREP_SEARCH_DESCRIPTION = 'IMPORTANT: If you need to explore the codebase of a public GitHub repository (not your local workspace), use warpgrep_github_search instead of warpgrep_codebase_search. When the task requires understanding code in an external repo, invoke warpgrep_github_search with a GitHub URL or owner/repo shorthand (e.g., vercel/next.js) and a natural-language query describing the target functionality, bug, or architectural concern. WarpGrep searches GitHub repos the same way it searches local codebases: fast and accurate. Keep queries action-oriented (e.g., "Find where how the new use workflow directive works"), and after reviewing the results, you may verify important findings with other tools or direct file reads. WarpGrep can be used for query types like: find function responsible for <small feature>; find code that does <description>; find code path for <big feature>; Where does <minimal error message> come from?; or any query of that type. When a task involves exploring code in an external public repo, ALWAYS use warpgrep_github_search.';
2473
+ var GITHUB_SEARCH_TOOL_NAME = GITHUB_WARP_GREP_SEARCH_TOOL_NAME;
2474
+ var GITHUB_SEARCH_DESCRIPTION = GITHUB_WARP_GREP_SEARCH_DESCRIPTION;
2475
+ var GITHUB_READ_FILE_TOOL_NAME = "readfile_github_search";
2476
+ var GITHUB_READ_FILE_DESCRIPTION = "Read a single file (or a line range) from a public GitHub repository. Use this when you already know the exact file path you want to read, for example after finding it via warpgrep_github_search results. Takes owner/repo shorthand and the file path within the repo. Optionally specify startLine and endLine (1-based) to read a specific range. Returns the file content with line numbers.";
2391
2477
 
2392
2478
  // tools/warp_grep/gemini.ts
2393
2479
  var TOOL_PARAMETERS = {
@@ -2455,9 +2541,36 @@ function createGitHubSearchTool(config) {
2455
2541
  }
2456
2542
  });
2457
2543
  }
2544
+ var GITHUB_READ_FILE_PARAMETERS = {
2545
+ type: "OBJECT",
2546
+ properties: {
2547
+ github: { type: "STRING", description: 'owner/repo shorthand (e.g., "vercel/next.js")' },
2548
+ path: { type: "STRING", description: "File path within the repository" },
2549
+ startLine: { type: "NUMBER", description: "Start line number (1-based)" },
2550
+ endLine: { type: "NUMBER", description: "End line number (1-based, inclusive)" },
2551
+ branch: { type: "STRING", description: "Branch to read from (defaults to repo default branch)" }
2552
+ },
2553
+ required: ["github", "path"]
2554
+ };
2555
+ function createGitHubReadFileTool(config) {
2556
+ const declaration = {
2557
+ name: GITHUB_READ_FILE_TOOL_NAME,
2558
+ description: GITHUB_READ_FILE_DESCRIPTION,
2559
+ parameters: GITHUB_READ_FILE_PARAMETERS
2560
+ };
2561
+ return Object.assign(declaration, {
2562
+ execute: async (input) => {
2563
+ return executeGitHubReadFile(input, config);
2564
+ },
2565
+ formatResult: (result) => {
2566
+ return formatGitHubReadFileResult(result);
2567
+ }
2568
+ });
2569
+ }
2458
2570
  var gemini_default = warpGrepFunctionDeclaration;
2459
2571
  // Annotate the CommonJS export names for ESM import in node:
2460
2572
  0 && (module.exports = {
2573
+ createGitHubReadFileTool,
2461
2574
  createGitHubSearchTool,
2462
2575
  createMorphWarpGrepTool,
2463
2576
  createWarpGrepTool,