@blockrun/runcode 2.5.6 → 2.5.7

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.
@@ -106,7 +106,11 @@ async function execute(input, ctx) {
106
106
  }
107
107
  });
108
108
  withMtime.sort((a, b) => b.mtime - a.mtime);
109
- const sorted = withMtime.map(f => f.path);
109
+ // Convert to relative paths to save tokens (same as Claude Code)
110
+ const sorted = withMtime.map(f => {
111
+ const rel = path.relative(ctx.workingDir, f.path);
112
+ return rel.startsWith('..') ? f.path : rel;
113
+ });
110
114
  if (sorted.length === 0) {
111
115
  // Suggest recursive pattern if user used non-recursive glob
112
116
  const hint = !pattern.includes('**') && !pattern.includes('/')
@@ -32,12 +32,18 @@ async function execute(input, ctx) {
32
32
  const mode = opts.output_mode || 'files_with_matches';
33
33
  const limit = opts.head_limit ?? 250;
34
34
  if (hasRipgrep()) {
35
- return runRipgrep(opts, searchPath, mode, limit);
35
+ return runRipgrep(opts, searchPath, mode, limit, ctx.workingDir);
36
36
  }
37
- return runNativeGrep(opts, searchPath, mode, limit);
37
+ return runNativeGrep(opts, searchPath, mode, limit, ctx.workingDir);
38
38
  }
39
- function runRipgrep(opts, searchPath, mode, limit) {
39
+ function toRelative(absPath, cwd) {
40
+ const rel = path.relative(cwd, absPath);
41
+ return rel.startsWith('..') ? absPath : rel;
42
+ }
43
+ function runRipgrep(opts, searchPath, mode, limit, cwd) {
40
44
  const args = [];
45
+ // Limit line length to prevent base64/minified content from cluttering output
46
+ args.push('--max-columns', '500');
41
47
  switch (mode) {
42
48
  case 'files_with_matches':
43
49
  args.push('-l');
@@ -76,7 +82,17 @@ function runRipgrep(opts, searchPath, mode, limit) {
76
82
  });
77
83
  const lines = result.split('\n').filter(Boolean);
78
84
  const limited = limit > 0 ? lines.slice(0, limit) : lines;
79
- let output = limited.join('\n');
85
+ // Convert absolute paths to relative paths to save tokens (same as Claude Code)
86
+ const relativized = limited.map(line => {
87
+ // Lines: /abs/path or /abs/path:rest (content mode)
88
+ const colonIdx = line.indexOf(':');
89
+ if (colonIdx > 0 && line.startsWith('/')) {
90
+ const filePart = line.slice(0, colonIdx);
91
+ return toRelative(filePart, cwd) + line.slice(colonIdx);
92
+ }
93
+ return line.startsWith('/') ? toRelative(line, cwd) : line;
94
+ });
95
+ let output = relativized.join('\n');
80
96
  if (lines.length > limited.length) {
81
97
  output += `\n\n... (${lines.length - limited.length} more results, use head_limit to see more)`;
82
98
  }
@@ -97,7 +113,7 @@ function runRipgrep(opts, searchPath, mode, limit) {
97
113
  };
98
114
  }
99
115
  }
100
- function runNativeGrep(opts, searchPath, mode, limit) {
116
+ function runNativeGrep(opts, searchPath, mode, limit, cwd) {
101
117
  const args = ['-r', '-n'];
102
118
  if (opts.case_insensitive)
103
119
  args.push('-i');
@@ -128,7 +144,14 @@ function runNativeGrep(opts, searchPath, mode, limit) {
128
144
  });
129
145
  const lines = result.split('\n').filter(Boolean);
130
146
  const limited = limit > 0 ? lines.slice(0, limit) : lines;
131
- let output = limited.join('\n');
147
+ const relativized = limited.map(line => {
148
+ const colonIdx = line.indexOf(':');
149
+ if (colonIdx > 0 && line.startsWith('/')) {
150
+ return toRelative(line.slice(0, colonIdx), cwd) + line.slice(colonIdx);
151
+ }
152
+ return line.startsWith('/') ? toRelative(line, cwd) : line;
153
+ });
154
+ let output = relativized.join('\n');
132
155
  if (lines.length > limited.length) {
133
156
  output += `\n\n... (${lines.length - limited.length} more results)`;
134
157
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/runcode",
3
- "version": "2.5.6",
3
+ "version": "2.5.7",
4
4
  "description": "RunCode — AI coding agent powered by 41+ models. Pay per use with USDC.",
5
5
  "type": "module",
6
6
  "bin": {