@blockrun/runcode 1.6.3 → 1.6.4
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.
- package/dist/tools/bash.js +5 -1
- package/dist/tools/grep.js +8 -0
- package/package.json +1 -1
package/dist/tools/bash.js
CHANGED
|
@@ -14,7 +14,11 @@ async function execute(input, ctx) {
|
|
|
14
14
|
const shell = process.env.SHELL || '/bin/bash';
|
|
15
15
|
const child = spawn(shell, ['-c', command], {
|
|
16
16
|
cwd: ctx.workingDir,
|
|
17
|
-
env: {
|
|
17
|
+
env: {
|
|
18
|
+
...process.env,
|
|
19
|
+
RUNCODE: '1', // Let scripts detect they're running inside runcode
|
|
20
|
+
RUNCODE_WORKDIR: ctx.workingDir,
|
|
21
|
+
},
|
|
18
22
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
19
23
|
});
|
|
20
24
|
let stdout = '';
|
package/dist/tools/grep.js
CHANGED
|
@@ -49,6 +49,12 @@ function runRipgrep(opts, searchPath, mode, limit) {
|
|
|
49
49
|
if (opts.context && opts.context > 0) {
|
|
50
50
|
args.push(`-C${opts.context}`);
|
|
51
51
|
}
|
|
52
|
+
else {
|
|
53
|
+
if (opts.before_context && opts.before_context > 0)
|
|
54
|
+
args.push(`-B${opts.before_context}`);
|
|
55
|
+
if (opts.after_context && opts.after_context > 0)
|
|
56
|
+
args.push(`-A${opts.after_context}`);
|
|
57
|
+
}
|
|
52
58
|
break;
|
|
53
59
|
}
|
|
54
60
|
if (opts.case_insensitive)
|
|
@@ -142,6 +148,8 @@ export const grepCapability = {
|
|
|
142
148
|
description: 'Output mode: "content" (matching lines), "files_with_matches" (file paths), "count" (match counts). Default: files_with_matches',
|
|
143
149
|
},
|
|
144
150
|
context: { type: 'number', description: 'Lines of context around each match (content mode only)' },
|
|
151
|
+
before_context: { type: 'number', description: 'Lines before each match (-B, content mode)' },
|
|
152
|
+
after_context: { type: 'number', description: 'Lines after each match (-A, content mode)' },
|
|
145
153
|
case_insensitive: { type: 'boolean', description: 'Case-insensitive search' },
|
|
146
154
|
head_limit: { type: 'number', description: 'Max results to return. Default: 250' },
|
|
147
155
|
multiline: { type: 'boolean', description: 'Enable multiline mode (patterns span lines). Default: false' },
|