Changesets · Branches · Tags · Compare
| Changeset | f2228a904ad3941f84afbfbbf1bc5194034778f6f197832d40fadc0304d0158f |
|---|---|
| Author | Nate <sestinj@gmail.com> · 2025-08-22 19:01 -07:00 |
| Committer | Nate <sestinj@gmail.com> · 2025-08-22 19:01 -07:00 |
| Parents | 8d79223bfeb8 |
1 file changed
modified extensions/cli/src/tools/readFile.ts +7 −0
| @@ -39,6 +39,13 @@ | ||
| 39 | 39 | const content = fs.readFileSync(args.filepath, "utf-8"); |
| 40 | 40 | // Mark this file as read for the edit tool |
| 41 | 41 | markFileAsRead(args.filepath); |
| 42 | + | |
| 43 | + const lines = content.split('\n'); | |
| 44 | + if (lines.length > 5000) { | |
| 45 | + const truncatedContent = lines.slice(0, 5000).join('\n'); | |
| 46 | + return `Content of ${args.filepath} (truncated to first 5000 lines of ${lines.length} total):\n${truncatedContent}`; | |
| 47 | + } | |
| 48 | + | |
| 42 | 49 | return `Content of ${args.filepath}:\n${content}`; |
| 43 | 50 | } catch (error) { |
| 44 | 51 | return `Error reading file: ${ |